제출 #170342

#제출 시각아이디문제언어결과실행 시간메모리
170342ngmhLaugh Analysis (IOI16_laugh)C++11
100 / 100
8 ms760 KiB
#include "laugh.h"
#include <bits/stdc++.h>
using namespace std;

int longest_laugh(string s) {
    int best = 0, current = 1;
    for(int i = 1; i < s.size(); i++){
        if((s[i-1] == 'a' && s[i] == 'h') || (s[i-1] == 'h' && s[i] == 'a')) current++;
        else {
            best = max(best, current);
            current = 1;
        }
    }
    best = max(best, current);
	return best;
}

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

laugh.cpp: In function 'int longest_laugh(std::__cxx11::string)':
laugh.cpp:7:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 1; i < s.size(); i++){
                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...