Submission #253898

#TimeUsernameProblemLanguageResultExecution timeMemory
253898MolukhyyehNadan (COCI18_nadan)C++14
10 / 50
1 ms256 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end() 

int const N = 200001;

int main(){
    int n, k;
    scanf("%d%d", &k, &n);
    int i = 1; 
    if(k >= (n * (n+1))/2){
    while(i < n && k > 0){
       printf("%d\n", i++);
       k-=i;
    }
    printf("%d\n", k);
   }
   else {
     for(int j = 0; j<n-1; ++j)printf("1\n");
     printf("%d\n", k-(n-1));
   }
}

Compilation message (stderr)

nadan.cpp: In function 'int main()':
nadan.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &k, &n);
     ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...