Submission #940855

# Submission time Handle Problem Language Result Execution time Memory
940855 2024-03-07T18:56:39 Z rainboy 팩토리얼 세제곱들의 합 (YDX14_fact) C
0 / 1
1 ms 348 KB
#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);
      |  ^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory 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 -