def main():
n,k=list(map(int,input().split()))
S=0
fact=[1,1,2,6,24]
for i in range(0,min(n,4)+1):
S+=fact[i]**k
print(S%10) if S%10 else print((S//10)%10)
main()
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
3 KB |
answer is '4' |
2 |
Correct |
25 ms |
3 KB |
answer is '2' |
3 |
Correct |
25 ms |
3 KB |
answer is '2' |
4 |
Correct |
28 ms |
3 KB |
answer is '2' |
5 |
Correct |
26 ms |
3 KB |
answer is '2' |
6 |
Correct |
27 ms |
3 KB |
answer is '4' |
7 |
Correct |
25 ms |
3 KB |
answer is '6' |
8 |
Correct |
27 ms |
3 KB |
answer is '1' |
9 |
Correct |
26 ms |
3 KB |
answer is '2' |
10 |
Correct |
27 ms |
3 KB |
answer is '6' |
11 |
Correct |
30 ms |
3 KB |
answer is '4' |
12 |
Correct |
25 ms |
3 KB |
answer is '5' |
13 |
Correct |
39 ms |
3 KB |
answer is '2' |
14 |
Correct |
30 ms |
3 KB |
answer is '3' |
15 |
Correct |
28 ms |
3 KB |
answer is '4' |
16 |
Correct |
25 ms |
3 KB |
answer is '5' |
17 |
Incorrect |
24 ms |
3 KB |
expected '6', found '5' |
18 |
Halted |
0 ms |
0 KB |
- |