Submission #870816

# Submission time Handle Problem Language Result Execution time Memory
870816 2023-11-09T08:08:24 Z mertozel Magnus (COCI18_magnus) C++11
30 / 50
3 ms 604 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){

	string str;
	cin >> str;

	int n = str.size();

	int cnt = 0;
	int flag = 1;
	
	for(int i = 0; i<n; i++) {
		if(str[i] == 'H') {
			i++;
			while(str[i] != 'O' && i < n) i++;
			i++;
			while(str[i] != 'N' && i < n) i++;
			i++;
			while(str[i] != 'I' && i < n) i++;
			if(i == n) break;
			cnt++;
			continue;
		}	

		
	}
	cout << cnt << "\n";


	return 0;
}

Compilation message

magnus.cpp: In function 'int main()':
magnus.cpp:13:6: warning: unused variable 'flag' [-Wunused-variable]
   13 |  int flag = 1;
      |      ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 596 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Incorrect 2 ms 604 KB Output isn't correct
4 Halted 0 ms 0 KB -