結果
| 問題 | No.1791 Repeat Multiplication |
| コンテスト | |
| ユーザー |
ripity
|
| 提出日時 | 2021-11-21 15:35:32 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 735 ms / 3,000 ms |
| + 550µs | |
| コード長 | 516 bytes |
| 記録 | |
| コンパイル時間 | 1,628 ms |
| コンパイル使用メモリ | 83,468 KB |
| 実行使用メモリ | 92,396 KB |
| 最終ジャッジ日時 | 2026-08-28 02:45:12 |
| 合計ジャッジ時間 | 23,331 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int Q = sc.nextInt();
long[] dp = new long[N+1];
long[] sum = new long[N+1];
dp[1] = 1;
for( int i = 1; i <= N; i++ ) {
sum[i] = dp[i]+sum[i-1];
for( int j = 2; i*j <= N; j++ ) {
dp[i*j] += dp[i];
}
}
for( int i = 0; i < Q; i++ ) {
int x = sc.nextInt();
System.out.println(dp[x]*sum[N/x]);
}
sc.close();
}
}
ripity