結果

問題 No.1791 Repeat Multiplication
ユーザー 👑 ygussanyygussany
提出日時 2021-12-20 00:08:34
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 510 bytes
コンパイル時間 1,475 ms
コンパイル使用メモリ 28,696 KB
実行使用メモリ 29,336 KB
最終ジャッジ日時 2023-10-13 19:10:45
合計ジャッジ時間 11,142 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 95 ms
4,696 KB
testcase_09 AC 78 ms
4,592 KB
testcase_10 AC 77 ms
4,544 KB
testcase_11 AC 71 ms
4,476 KB
testcase_12 AC 37 ms
5,952 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 AC 2,491 ms
19,612 KB
testcase_16 AC 2,374 ms
21,320 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main()
{
	int i, N, Q;
	long long ans[2][1500001];
	scanf("%d %d", &N, &Q);
	
	int j;
	for (i = N; i >= 1; i--) for (j = 2, ans[0][i] = 1; i * j <= N; j++) ans[0][i] += ans[0][i*j];
	for (i = 1; i <= N; i++) {
		for (j = 2, ans[1][i] = 1; j * j < i; j++) if (i % j == 0) ans[1][i] += ans[1][j] + ans[1][i/j];
		if (j * j == i) ans[1][i] += ans[1][j];
	}
	
	int x;
	for (i = 1; i <= Q; i++) {
		scanf("%d", &x);
		printf("%lld\n", ans[0][x] * ans[1][x]);
	}
	fflush(stdout);
	return 0;
}
0