제출 #939393

#제출 시각아이디문제언어결과실행 시간메모리
939393KK_1729Laugh Analysis (IOI16_laugh)C++17
컴파일 에러
0 ms0 KiB
#include "laugh.h" #include <bits/stdc++.h> using namespace std; int longest_laugh(string s) { int n = s.size(); vector<int> dp(n); if (s[0] == 'h' || s[0] == 'a') dp[0] = 1; FOR(i,0,n){ if (s[i] == 'h'){ if (s[i-1] == 'a') dp[i] = dp[i-1]+1; } if (s[i] == 'a'){ if (s[i-1] == 'h') dp[i] = dp[i-1]+1; } } int ans = 0; for (auto x: dp) ans = max(ans, x); return ans; }

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

laugh.cpp: In function 'int longest_laugh(std::string)':
laugh.cpp:9:9: error: 'i' was not declared in this scope
    9 |     FOR(i,0,n){
      |         ^
laugh.cpp:9:5: error: 'FOR' was not declared in this scope
    9 |     FOR(i,0,n){
      |     ^~~