Submission #22202

# Submission time Handle Problem Language Result Execution time Memory
22202 2017-04-29T17:46:41 Z 내일 시험이에요(#1036, pjh0123) None (KRIII5P_2) C++11
7 / 7
229 ms 5060 KB
#include <cstdio>

int a[1010101];
int main(){
    int n,p;
    scanf("%d%d",&n,&p);

    for(int i=n;i>=0;i--){
        int x;
        scanf("%d",&x);
        if(i==0)printf("%d\n",x%p);
        x%=p;
        a[i%(p-1)]+=x;
        a[i%(p-1)]%=p;
    }

    
    for(int i=1;i<p;i++){
        int s = 0;
        int x = 1;
        for(int j=0;j<p-1;j++){
            s = (s + x*a[j])%p;
            x = x*i%p;
        }
        printf("%d\n",s);
    }

}

Compilation message

pc.cpp: In function 'int main()':
pc.cpp:6: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:10: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 5060 KB Output is correct
2 Correct 0 ms 5060 KB Output is correct
3 Correct 0 ms 5060 KB Output is correct
4 Correct 0 ms 5060 KB Output is correct
5 Correct 0 ms 5060 KB Output is correct
6 Correct 13 ms 5060 KB Output is correct
7 Correct 13 ms 5060 KB Output is correct
8 Correct 13 ms 5060 KB Output is correct
9 Correct 13 ms 5060 KB Output is correct
10 Correct 16 ms 5060 KB Output is correct
11 Correct 9 ms 5060 KB Output is correct
12 Correct 9 ms 5060 KB Output is correct
13 Correct 3 ms 5060 KB Output is correct
14 Correct 0 ms 5060 KB Output is correct
15 Correct 0 ms 5060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5060 KB Output is correct
2 Correct 0 ms 5060 KB Output is correct
3 Correct 0 ms 5060 KB Output is correct
4 Correct 0 ms 5060 KB Output is correct
5 Correct 0 ms 5060 KB Output is correct
6 Correct 13 ms 5060 KB Output is correct
7 Correct 13 ms 5060 KB Output is correct
8 Correct 13 ms 5060 KB Output is correct
9 Correct 13 ms 5060 KB Output is correct
10 Correct 16 ms 5060 KB Output is correct
11 Correct 9 ms 5060 KB Output is correct
12 Correct 9 ms 5060 KB Output is correct
13 Correct 3 ms 5060 KB Output is correct
14 Correct 0 ms 5060 KB Output is correct
15 Correct 0 ms 5060 KB Output is correct
16 Correct 216 ms 5060 KB Output is correct
17 Correct 189 ms 5060 KB Output is correct
18 Correct 229 ms 5060 KB Output is correct
19 Correct 196 ms 5060 KB Output is correct
20 Correct 169 ms 5060 KB Output is correct
21 Correct 189 ms 5060 KB Output is correct
22 Correct 216 ms 5060 KB Output is correct
23 Correct 206 ms 5060 KB Output is correct
24 Correct 203 ms 5060 KB Output is correct
25 Correct 196 ms 5060 KB Output is correct
26 Correct 219 ms 5060 KB Output is correct
27 Correct 199 ms 5060 KB Output is correct
28 Correct 193 ms 5060 KB Output is correct
29 Correct 209 ms 5060 KB Output is correct
30 Correct 196 ms 5060 KB Output is correct