답안 #494864

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
494864 2021-12-16T21:37:09 Z Christopher_ Laugh Analysis (IOI16_laugh) C++17
0 / 100
1 ms 344 KB
#include "laugh.h"
#include <bits/stdc++.h>

using namespace std;

int longest_laugh(std::string s)
{
  int cnt = 0;
  char last = 'z';
  int mx = 0;
  for (int i = 0; i < (int) s.size(); ++i) {
    if ((s[i] == 'a' || s[i] == 'h') && s[i] != last) {
      ++cnt;
      if (last == 'z') last = s[i];
      else if (last == 'a') last = 'h';
      else last = 'a';
    } else {
      last = 'z';
      mx = max(mx, cnt);
      cnt = 0;
    }
  }
  mx = max(mx, cnt);
  return mx;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 292 KB numbers differ - expected: '2', found: '1'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 292 KB numbers differ - expected: '2', found: '1'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 292 KB numbers differ - expected: '2', found: '1'
3 Halted 0 ms 0 KB -