Submission #149957

# Submission time Handle Problem Language Result Execution time Memory
149957 2019-09-01T07:27:40 Z usa1+samsung2(#3703, adman, nona1314, wowoto9772) HicCup (FXCUP4_hiccup) C++17
0 / 100
6 ms 384 KB
#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
1 Correct 6 ms 384 KB Output is correct
2 Incorrect 6 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Incorrect 6 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -