Submission #92163

#TimeUsernameProblemLanguageResultExecution timeMemory
92163KastandaMagnus (COCI18_magnus)C++11
50 / 50
8 ms380 KiB
#include<bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, tot, cur;
char S[N], pat[4] = {'H', 'O', 'N', 'I'};
int main()
{
    scanf("%s", S); n = strlen(S);
    for (int i = 0; i < n; i++)
        if (S[i] == pat[cur])
            cur = (cur + 1) % 4, tot += (cur == 0);
    return !printf("%d\n", tot);
}

Compilation message (stderr)

magnus.cpp: In function 'int main()':
magnus.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s", S); n = strlen(S);
     ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...