답안 #956586

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
956586 2024-04-02T07:51:27 Z DeltaStruct Laugh Analysis (IOI16_laugh) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
#include "laugh.h"
using namespace std;
 
int longest_laugh(string s){
  int r = 0;
  for (int i(0),k(0),j(0);i < s.size();++i){
    k = (s[i]==string("ah")[k&1]?k+1:(int)(s[i]=='a'));
    k = (s[i]==string("ha")[k&1]?k+1:(int)(s[i]=='a'));
    r = max(r,k);
  }
  return r;
}

Compilation message

laugh.cpp: In function 'int longest_laugh(std::string)':
laugh.cpp:7:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |   for (int i(0),k(0),j(0);i < s.size();++i){
      |                           ~~^~~~~~~~~~
laugh.cpp:7:22: warning: unused variable 'j' [-Wunused-variable]
    7 |   for (int i(0),k(0),j(0);i < s.size();++i){
      |                      ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB numbers differ - expected: '1', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB numbers differ - expected: '1', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB numbers differ - expected: '1', found: '2'
2 Halted 0 ms 0 KB -