제출 #85385

#제출 시각아이디문제언어결과실행 시간메모리
85385DiegoGarciaNadan (COCI18_nadan)C++14
15 / 50
2 ms620 KiB
#include <stdio.h>
#define ll long long
ll n,k, ans[1000],each, res;
int main()
{
    //los n_i son distintos enteros positivos que suman k y siempre se puede => k >= n*(n+1)/2
    scanf("%lld %lld",&k,&n);
    k -= ((n*(n+1))/2);
    each = k/n;
    res = k - each*n;
    for( ll i=n-1; i >= 0; i-- )
    {
        ans[i] = each + i + 1;
        if( res-- > 0 ) ans[i]++;
    }
    for(ll i=0; i<n; i++ ) printf("%lld ",ans[i]);
    return 0;
}

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

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