Task: | Sanalista |
Sender: | pyronk |
Submission time: | 2020-09-30 21:41:25 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | ACCEPTED | 0.01 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:30:30: warning: converting to non-pointer type 'long int' from NULL [-Wconversion-null] (even(e) ? right++ : NULL); ^~~~
Code
#include <iostream> #include <vector> #include <algorithm> #include <string> using namespace std; char alphabet[] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' }; bool even(string str) { for (char e : alphabet) { size_t n = std::count(str.begin(), str.end(), e); if (n % 2 != 0) { return false; } } return true; } int main() { vector<string> strings; string str; int amount; int right = 0; cin >> amount; for (int i = 0; i < amount; i++) { cin >> str; strings.push_back(str); } for (auto e : strings) { (even(e) ? right++ : NULL); } cout << right; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1000 korvata sopimusaika nuhatartunta korttiautomaatti ... |
correct output |
---|
15 |
user output |
---|
15 |
Test 2
Verdict: ACCEPTED
input |
---|
1000 pub hansikaslokero erikoisvalmisteinen unijukka ... |
correct output |
---|
42 |
user output |
---|
42 |
Test 3
Verdict: ACCEPTED
input |
---|
1000 haapalastu toipumisaika mustalaiskieli taidelainaamo ... |
correct output |
---|
70 |
user output |
---|
70 |