답안 #95334

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
95334 2019-01-30T10:16:59 Z mzhao Magnus (COCI18_magnus) C++11
50 / 50
6 ms 636 KB
#include <bits/stdc++.h>
using namespace std;

int ans;
string S;
char nxt[4] = {'H', 'O', 'N', 'I'};

int main() {
	cin >> S;
	for (int i = 0, cur = 0; i < S.size(); i++) {
		if (S[i] == nxt[cur]) {
			cur++;
			if (cur == 4) {
				ans++;
				cur = 0;
			}
		}
	}
	printf("%d\n", ans);
}

Compilation message

magnus.cpp: In function 'int main()':
magnus.cpp:10:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0, cur = 0; i < S.size(); i++) {
                           ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 252 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 632 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 5 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 608 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 5 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 632 KB Output is correct
2 Correct 6 ms 604 KB Output is correct
3 Correct 6 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 636 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 5 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 632 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 5 ms 632 KB Output is correct