제출 #472252

#제출 시각아이디문제언어결과실행 시간메모리
472252MamdouhNNadan (COCI18_nadan)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" main() { int n,k; cin>>k>>n; k-=(n*(n+1))/2; int extra=k%n; int addtoall=(k-(k%n))/n; for(int i=0;i<n;i++) { int x = (i+1)+addtoall; if(i==n-1)x+=extra; sum+=x; cout<<x<<endl; } }

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

nadan.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~
nadan.cpp: In function 'int main()':
nadan.cpp:16:9: error: 'sum' was not declared in this scope
   16 |         sum+=x;
      |         ^~~