이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "hiccup.h"
#include <iostream>
using namespace std;
int HicCup(std::string S) {
int N = S.size();
int h = (S[0]=='H' ? 1 : 0);
int x = 0;
char c = S[0];
for(int i=1;i<N;i++){
if(S[i] == 'H') h++;
if(S[i] == '!') x++;
switch(c) {
case 'H':
if(S[i]=='!') {
//cout << "H->!" << endl;
return -1;
}
break;
case 'C':
/*
if(S[i]=='C') {
cout << "C->C" << endl;
return -1;
}*/
break;
case '!':
break;
default:
return -1;
break;
}
c = S[i];
}
return (x/h);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |