Submission #132297

# Submission time Handle Problem Language Result Execution time Memory
132297 2019-07-18T16:49:14 Z bkerr Magnus (COCI18_magnus) C++14
50 / 50
9 ms 636 KB
#include <bits/stdc++.h>
using namespace std;




int main() {

    string s;
    cin >> s;


    int pos = 0;
    int counter = 0;
    for (int i=0; i<s.size(); i++) {

        if (pos == 0 && s[i] == 'H') {
            pos++;
        }

        if (pos == 1 && s[i] == 'O') {
            pos++;
        }

        if (pos == 2 && s[i] == 'N') {
            pos++;
        }

        if (pos == 3 && s[i] == 'I') {
            pos++;
        }


        if (pos == 4) {
            counter++;
            pos = 0;
        }
    }


    cout << counter << endl;
    return 0;
}

Compilation message

magnus.cpp: In function 'int main()':
magnus.cpp:15:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0; i<s.size(); i++) {
                   ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 632 KB Output is correct
2 Correct 8 ms 624 KB Output is correct
3 Correct 8 ms 628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 636 KB Output is correct
2 Correct 8 ms 632 KB Output is correct
3 Correct 8 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 628 KB Output is correct
2 Correct 8 ms 632 KB Output is correct
3 Correct 8 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 632 KB Output is correct
2 Correct 8 ms 632 KB Output is correct
3 Correct 8 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 632 KB Output is correct
2 Correct 9 ms 632 KB Output is correct
3 Correct 9 ms 632 KB Output is correct