Submission #96381

#TimeUsernameProblemLanguageResultExecution timeMemory
96381DiegoGarciaMagnus (COCI18_magnus)C++11
50 / 50
3 ms532 KiB
#include <bits/stdc++.h> #define optimiza_io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define pb push_back #define ft first #define sd second #define ll long long #define ld long double #define ull unsigned long long #define INF 1E5 #define LINF 1E18 using namespace std; const int maxn = 1e5+3; char s[maxn],need; int cnt=0; int main() { scanf("%s",&s); need = 'H'; for( int i=0; i<strlen(s); i++ ) { if( s[i] == need ){ if( s[i] == 'H' ) need = 'O'; else if( s[i] == 'O' ) need = 'N'; else if( s[i] == 'N' ) need = 'I'; else if( s[i] == 'I' ){ need = 'H'; cnt++; } } } printf("%d",cnt); return 0; }

Compilation message (stderr)

magnus.cpp: In function 'int main()':
magnus.cpp:19:18: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'char (*)[100003]' [-Wformat=]
     scanf("%s",&s);
                ~~^
magnus.cpp:21:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for( int i=0; i<strlen(s); i++ )
                   ~^~~~~~~~~~
magnus.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s",&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...