Submission #94864

# Submission time Handle Problem Language Result Execution time Memory
94864 2019-01-24T16:40:56 Z karlopuh Magnus (COCI18_magnus) C++14
50 / 50
6 ms 632 KB
#include <bits/stdc++.h>
using namespace std;

string ulaz;
int brojac;
int stanje=0;

int main(){
	cin>>ulaz;
	for(int i=0;i<ulaz.size();i++){
		if(ulaz[i]=='H' && stanje==0){
			stanje=1;
		}
		else if(ulaz[i]=='O' && stanje==1){
			stanje=2;
		}
		else if(ulaz[i]=='N' && stanje==2){
			stanje=3;
		}
		else if(ulaz[i]=='I' && stanje==3){
			stanje=0;
			brojac++;
		}
	}
	
	cout<<brojac;
}

Compilation message

magnus.cpp: In function 'int main()':
magnus.cpp:10:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<ulaz.size();i++){
              ~^~~~~~~~~~~~
# 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 380 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 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 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 252 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 6 ms 632 KB Output is correct
2 Correct 6 ms 624 KB Output is correct
3 Correct 6 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 632 KB Output is correct
2 Correct 6 ms 632 KB Output is correct
3 Correct 6 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 628 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 6 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 632 KB Output is correct
2 Correct 6 ms 632 KB Output is correct
3 Correct 6 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 632 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 6 ms 632 KB Output is correct