제출 #149132

#제출 시각아이디문제언어결과실행 시간메모리
149132bitKOIn (#200)HicCup (FXCUP4_hiccup)C++17
24 / 100
21 ms3328 KiB
#include "hiccup.h"

int HicCup(std::string S) {
	int N = S.size();
	//if(N)
	int a=0;
	for(int t=0;t<N;t++)
    {
        if(S[t]=='H') a++;
        else a--;
        if(a<0) return -1;
    }
    if(a)
	return -1;
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

hiccup.cpp: In function 'int HicCup(std::__cxx11::string)':
hiccup.cpp:13:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if(a)
     ^~
hiccup.cpp:15:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  return 0;
  ^~~~~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…