# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472394 | MamdouhN | Nadan (COCI18_nadan) | C++17 | 1 ms | 204 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
vector<int>ans;
main()
{
int n,k;
cin>>k>>n;
k-=((n*(n+1))/2);
if(k<0)
{
k+=((n*(n+1))/2);
for(int i=0;i<n;i++)
{
int x=k/n;
if(i==n-1)x+=k%n;
cout<<x<<endl;
}
return 0;
}
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;
cout<<x<<endl;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |