# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472252 | 2021-09-13T10:20:41 Z | MamdouhN | Nadan (COCI18_nadan) | C++17 | 0 ms | 0 KB |
#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; } }