Submission #146089

# Submission time Handle Problem Language Result Execution time Memory
146089 2019-08-22T04:01:20 Z youssan_william Magnus (COCI18_magnus) C++14
50 / 50
9 ms 632 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
int main()
{
    string s;
    cin >> s;
    string target= "HONI";
    int c=0,ans=0;
    for(int i = 0 ; i < s.size() ;i++)
    {
        if(s[i]==target[c])
        {
            c++;
        }
        if(c==4)
        {
            ans++;
            c=0;
        }
    }
    cout << ans;
    return 0;
}

Compilation message

magnus.cpp: In function 'int main()':
magnus.cpp:11:23: 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 3 ms 376 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 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 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 252 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 604 KB Output is correct
2 Correct 9 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 8 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 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 9 ms 632 KB Output is correct
2 Correct 9 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 8 ms 632 KB Output is correct