답안 #199796

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
199796 2020-02-03T12:56:31 Z MohamedAhmed04 Magnus (COCI18_magnus) C++14
50 / 50
6 ms 632 KB
#include <bits/stdc++.h>

using namespace std ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	string s ;
	cin>>s ;
	int n = s.size() ;
	int ans = 0 ;
	char c = 'H' ;
	map<char , char>nxt ;
	nxt['H'] = 'O' ;
	nxt['O'] = 'N' ;
	nxt['N'] = 'I' ;
	nxt['I'] = 'H' ;
	for(auto &i : s)
	{
		if(i == c)
		{
			ans += (c == 'I') ;
			c = nxt[c] ;
		}
	}
	return cout<<ans<<"\n" , 0 ;
}

Compilation message

magnus.cpp: In function 'int main()':
magnus.cpp:11:6: warning: unused variable 'n' [-Wunused-variable]
  int n = s.size() ;
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 6 ms 504 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 632 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 5 ms 540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 6 ms 632 KB Output is correct
3 Correct 5 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 504 KB Output is correct
2 Correct 6 ms 504 KB Output is correct
3 Correct 6 ms 504 KB Output is correct