Submission #22203

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

Compilation message

pc.cpp: In function 'int main()':
pc.cpp:4:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&p);
                        ^
pc.cpp:6:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
                       ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5032 KB Output is correct
2 Correct 0 ms 5032 KB Output is correct
3 Incorrect 0 ms 5032 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5032 KB Output is correct
2 Correct 0 ms 5032 KB Output is correct
3 Incorrect 0 ms 5032 KB Output isn't correct
4 Halted 0 ms 0 KB -