답안 #85385

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
85385 2018-11-19T15:12:52 Z DiegoGarcia Nadan (COCI18_nadan) C++14
15 / 50
2 ms 620 KB
#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;
}

Compilation message

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);
     ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 496 KB Output isn't correct
3 Incorrect 2 ms 496 KB Output isn't correct
4 Correct 2 ms 496 KB Output is correct
5 Incorrect 2 ms 496 KB Output isn't correct
6 Incorrect 2 ms 620 KB Output isn't correct
7 Incorrect 2 ms 620 KB Output isn't correct
8 Correct 2 ms 620 KB Output is correct
9 Correct 2 ms 620 KB Output is correct
10 Incorrect 2 ms 620 KB Output isn't correct