제출 #94815

#제출 시각아이디문제언어결과실행 시간메모리
94815quoriessRima (COCI17_rima)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int lli; typedef pair<lli,lli> pii; #define dbg(x) cout<<#x<<" has a value of: "<<x<<"\n"; #define usize(x) (int)(x.size()) #define plist(x) for(int i=0;i<usize(x);i++)cout<<"eleman "<<i<<" = "<<x[i]<<"\n"; #define foreach(x) for(auto item:x) #define fill(s,x) for(int i=0;i<x;i++)cin>>s[i]; #define in(veriler,a) (veriler.find(a)!=veriler.end()) #define btw(x,y,z) x>=y && x<=z std::ostream& operator<<(std::ostream& os, pair<int,int> p) { os << p.first << ", " << p.second; return os; } int main(){ int n; cin>>n; vector<string> dizi; for (int i = 0; i < n; i++) { string s; cin>>s; reverse(s.begin(),s.end()); dizi.push_back(s); } sort(dizi.begin(),dizi.end()); int mc=1; int mx=1; for (int i = 1; i < n; i++) { int k1=0; while(k1<(int)min(dizi[i-1].size(),dizi[i].size()) && dizi[i-1][k1]==dizi[i][k]){ k1++; } int hm=max(dizi[i].size(),dizi[i-1].size()); if((k1==hm || k1==hm-1;){ mc++; mx=max(mc,mx); } else{ mc=1; } } cout<<mx<<"\n"; return 0; }

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

rima.cpp: In function 'int main()':
rima.cpp:33:80: error: 'k' was not declared in this scope
   while(k1<(int)min(dizi[i-1].size(),dizi[i].size()) && dizi[i-1][k1]==dizi[i][k]){
                                                                                ^
rima.cpp:33:80: note: suggested alternative: 'k1'
   while(k1<(int)min(dizi[i-1].size(),dizi[i].size()) && dizi[i-1][k1]==dizi[i][k]){
                                                                                ^
                                                                                k1
rima.cpp:37:25: error: expected ')' before ';' token
   if((k1==hm || k1==hm-1;){
                         ^
rima.cpp:37:25: error: expected ')' before ';' token
rima.cpp:37:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   if((k1==hm || k1==hm-1;){
   ^~
rima.cpp:37:26: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   if((k1==hm || k1==hm-1;){
                          ^
rima.cpp:37:26: error: expected primary-expression before ')' token
rima.cpp:41:3: error: 'else' without a previous 'if'
   else{
   ^~~~