-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path11560_PUCMM210.cpp
60 lines (53 loc) · 983 Bytes
/
11560_PUCMM210.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// 11560_11560.cpp
//
//
// Created by Haijun Deng on 13-5-25.
// Copyright (c) 2013 __MyCompanyName__. All rights reserved.
//
/*
TASK: A Summatory
ALGO: math
Input:
3
2
10
3
Output:
10
7942
46
*/
#include <cstdio>
typedef long long i64;
const int MOD = 1000000003;
inline i64 mod(i64 a)
{
return a < MOD ? a : a % MOD;
}
int main() {
int test, i;
i64 sum, n, p[6], co[6] = {0, 4, 30, 50, 30, 6}, inv = 441666668;
scanf("%d", &test);
while(test--)
{
scanf("%lld", &n);
for(i = 1, p[0] = 1; i <= 5; i++)
p[i] = mod(n * p[i-1]);
/*for (int i=0; i<=5; i++) {
printf("%lld ", p[i]);
}
printf("\n");*/
for(i = 1; i <= 5; i++)
p[i] = mod(co[i] * p[i]);
/*for (int i=0; i<=5; i++) {
printf("%lld ", p[i]);
}
printf("\n");*/
for(i = 1, sum = 0; i <= 5; i++)
sum = mod(sum + p[i]);
sum = mod(sum * inv);
printf("%lld\n", sum);
}
return 0;
}