답안 #472394

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472394 2021-09-13T12:55:41 Z MamdouhN Nadan (COCI18_nadan) C++17
15 / 50
1 ms 204 KB
#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

nadan.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Incorrect 0 ms 204 KB Output isn't correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Incorrect 1 ms 204 KB Output isn't correct