Submission #150636

# Submission time Handle Problem Language Result Execution time Memory
150636 2019-09-01T08:45:21 Z 요까할 로뭘 은명팀(#3558, mario05092929, foja001, earthk) HicCup (FXCUP4_hiccup) C++17
0 / 100
6 ms 384 KB
#include "hiccup.h"

int HicCup(std::string S) {
    int N = S.size();
    int Hea,Cea,iea,idx;
    for(int i =0;i<S.size();i++){
        if(S[i]=='H'){
            idx=i;
            break;
        }
    }
    for(int i =idx;i<S.size();i++){
        if(S[i]=='H')Hea++;
        if(S[i]=='C')Cea++;
        if(S[i]=='!')iea++;
    }
    if(Hea == Cea)return iea/Hea;
    else return -1;
}

Compilation message

hiccup.cpp: In function 'int HicCup(std::__cxx11::string)':
hiccup.cpp:6:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i =0;i<S.size();i++){
                  ~^~~~~~~~~
hiccup.cpp:12:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i =idx;i<S.size();i++){
                    ~^~~~~~~~~
hiccup.cpp:4:9: warning: unused variable 'N' [-Wunused-variable]
     int N = S.size();
         ^
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -