Submission #94705

# Submission time Handle Problem Language Result Execution time Memory
94705 2019-01-23T06:29:52 Z farukkastamonuda Magnus (COCI18_magnus) C++14
50 / 50
3 ms 508 KB
#include <bits/stdc++.h>
#define md 1000000007
#define fi first
#define se second
#define mp make_pair
#define	inf 1000000000
#define li 100005
#define lo long long
#define pb push_back
using namespace std;
int n,sira=0,cev;
char s[li];
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;i++){
		if(sira==0 && s[i]=='H'){
			sira++;
		}
		if(sira==1 && s[i]=='O'){
			sira++;
		}
		if(sira==2 && s[i]=='N'){
			sira++;
		}
		if(sira==3 && s[i]=='I'){
			cev++;
			sira=0;
		}
	}
	printf("%d\n",cev);
	return 0;
}

Compilation message

magnus.cpp: In function 'int main()':
magnus.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",s+1);
  ~~~~~^~~~~~~~~~
# 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 248 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 2 ms 396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 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 256 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 3 ms 504 KB Output is correct
2 Correct 3 ms 508 KB Output is correct
3 Correct 3 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 508 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 3 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 2 ms 508 KB Output is correct