#include <stdio.h>
int min(int a, int b) { return a < b ? a : b; }
int ans[4][5] = {
{ 1, 2, 3, 4, 5 },
{ 1, 2, 4, 0, 4 },
{ 1, 2, 6, 2, 8 },
{ 1, 2, 0, 6, 0 }
};
int main() {
int n, k;
scanf("%d%d", &n, &k);
printf("%d\n", k == 0 ? (n + 1) % 10 : ans[k][min(n, 4)]);
return 0;
}
Compilation message
fact.c: In function 'main':
fact.c:15:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
15 | scanf("%d%d", &n, &k);
| ^~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
answer is '4' |
2 |
Correct |
0 ms |
348 KB |
answer is '2' |
3 |
Correct |
0 ms |
348 KB |
answer is '2' |
4 |
Correct |
0 ms |
348 KB |
answer is '2' |
5 |
Correct |
0 ms |
348 KB |
answer is '2' |
6 |
Correct |
0 ms |
348 KB |
answer is '4' |
7 |
Correct |
0 ms |
348 KB |
answer is '6' |
8 |
Incorrect |
0 ms |
348 KB |
expected '1', found '0' |
9 |
Halted |
0 ms |
0 KB |
- |