Submission #870820

# Submission time Handle Problem Language Result Execution time Memory
870820 2023-11-09T08:16:39 Z vjudge1 Magnus (COCI18_magnus) C++11
50 / 50
2 ms 856 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;
	
	
	for(int i = 0; i<n; i++) {
		if(str[i] == 'H') {
			int flag = 1;
			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:17:8: warning: unused variable 'flag' [-Wunused-variable]
   17 |    int flag = 1;
      |        ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 344 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 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 416 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 2 ms 856 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 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 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 Correct 2 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct