Submission #22204

# Submission time Handle Problem Language Result Execution time Memory
22204 2017-04-29T18:01:34 Z 새벽 2시 22분(#1037, junodeveloper) None (KRIII5P_2) C++14
7 / 7
263 ms 8952 KB
#include<stdio.h>
long long n,p,x,a[1001],b[1001][1001],last;
int main() {
    scanf("%lld%lld",&n,&p);
    for(long long i=n;i>=0;i--) {
        scanf("%lld",&x);
        a[i%(p-1)] += x;
        last = x;
    }
    for(long long i=0;i<p;i++) {
        b[i][0] = 1;
        for(long long j=1;j<p;j++)
            b[i][j] = b[i][j-1] * i % p;
    }
    printf("%lld\n", last % p);
    for(long long i=1;i<p;i++) {
        long long res = 0;
        for(long long j=0;j<p;j++)
            res = (res + a[j] * b[i][j]) % p;
        printf("%lld\n", res);
    }
    return 0;
}

Compilation message

pc.cpp: In function 'int main()':
pc.cpp:4:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld",&n,&p);
                            ^
pc.cpp:6:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&x);
                         ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 8952 KB Output is correct
2 Correct 0 ms 8952 KB Output is correct
3 Correct 0 ms 8952 KB Output is correct
4 Correct 0 ms 8952 KB Output is correct
5 Correct 0 ms 8952 KB Output is correct
6 Correct 43 ms 8952 KB Output is correct
7 Correct 43 ms 8952 KB Output is correct
8 Correct 39 ms 8952 KB Output is correct
9 Correct 43 ms 8952 KB Output is correct
10 Correct 29 ms 8952 KB Output is correct
11 Correct 23 ms 8952 KB Output is correct
12 Correct 26 ms 8952 KB Output is correct
13 Correct 9 ms 8952 KB Output is correct
14 Correct 6 ms 8952 KB Output is correct
15 Correct 6 ms 8952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 8952 KB Output is correct
2 Correct 0 ms 8952 KB Output is correct
3 Correct 0 ms 8952 KB Output is correct
4 Correct 0 ms 8952 KB Output is correct
5 Correct 0 ms 8952 KB Output is correct
6 Correct 43 ms 8952 KB Output is correct
7 Correct 43 ms 8952 KB Output is correct
8 Correct 39 ms 8952 KB Output is correct
9 Correct 43 ms 8952 KB Output is correct
10 Correct 29 ms 8952 KB Output is correct
11 Correct 23 ms 8952 KB Output is correct
12 Correct 26 ms 8952 KB Output is correct
13 Correct 9 ms 8952 KB Output is correct
14 Correct 6 ms 8952 KB Output is correct
15 Correct 6 ms 8952 KB Output is correct
16 Correct 186 ms 8952 KB Output is correct
17 Correct 166 ms 8952 KB Output is correct
18 Correct 179 ms 8952 KB Output is correct
19 Correct 183 ms 8952 KB Output is correct
20 Correct 183 ms 8952 KB Output is correct
21 Correct 263 ms 8952 KB Output is correct
22 Correct 223 ms 8952 KB Output is correct
23 Correct 239 ms 8952 KB Output is correct
24 Correct 216 ms 8952 KB Output is correct
25 Correct 229 ms 8952 KB Output is correct
26 Correct 239 ms 8952 KB Output is correct
27 Correct 203 ms 8952 KB Output is correct
28 Correct 193 ms 8952 KB Output is correct
29 Correct 196 ms 8952 KB Output is correct
30 Correct 173 ms 8952 KB Output is correct