제출 #1084424

#제출 시각아이디문제언어결과실행 시간메모리
1084424laureLutrija (COCI19_lutrija)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #define int long long using namespace std; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); vector<bool>vis(1005,0); set<int>p; for(int i=2;i<=1000;i++) { if(!vis[i]) { p.insert(i); for(int j=i*i;j<=1000;j+=i)vis[j]=1; } } int a,b; cin>>a>>b; if(p.count(abs(a-b))){cout<<a<<" "<<b<<'\n';return 0;} int ans=-1; for(auto u:p) { if(p.count(abs(a-u))&&p.count(abs(b-u))) { ans=u; break; } } else cout<<a<<" "<<ans<<" "<<b<<'\n'; }

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

lutrija.cpp: In function 'int main()':
lutrija.cpp:31:5: error: 'else' without a previous 'if'
   31 |     else cout<<a<<" "<<ans<<" "<<b<<'\n';
      |     ^~~~