답안 #91872

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
91872 2018-12-30T17:51:42 Z Ort Magnus (COCI18_magnus) C++14
50 / 50
7 ms 632 KB
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	string s;
	cin >> s;
	vector<char> S; int sol = 0;
	for(int i=0;i<s.length();i++) {
		if(s[i]!='H' && s[i]!='O' && s[i]!='N' && s[i]!='I') continue;
		if(s[i]=='H' && S.empty()) S.push_back(s[i]);
		if(s[i]=='O' && S.size()==1) S.push_back(s[i]);
		if(s[i]=='N' && S.size()==2) S.push_back(s[i]);
		if(s[i]=='I' && S.size()==3) S.push_back(s[i]);
		if(S.size()==4) {
			S.clear(); sol++;
		}
	}
	cout << sol;
	return 0;
}

Compilation message

magnus.cpp: In function 'int main()':
magnus.cpp:13:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<s.length();i++) {
              ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 1 ms 376 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 376 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 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 540 KB Output is correct
2 Correct 7 ms 632 KB Output is correct
3 Correct 3 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 632 KB Output is correct
3 Correct 3 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 632 KB Output is correct
2 Correct 3 ms 632 KB Output is correct
3 Correct 3 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 632 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 3 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 632 KB Output is correct
3 Correct 3 ms 532 KB Output is correct