結果
| 問題 | No.915 Plus Or Multiple Operation |
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2020-01-22 11:52:14 |
| 言語 | Java (openjdk 27 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 970 bytes |
| 記録 | |
| コンパイル時間 | 2,131 ms |
| コンパイル使用メモリ | 85,940 KB |
| 実行使用メモリ | 45,336 KB |
| 最終ジャッジ日時 | 2026-09-20 00:57:36 |
| 合計ジャッジ時間 | 3,962 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 10 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
int a = sc.nextInt();
long b = sc.nextInt();
int c = sc.nextInt();
if (c == 1) {
sb.append((long)c * b).append("\n");
continue;
}
long total = 0;
while (a >= 2 * c) {
if (a % c != 0) {
total++;
a = a / c * c;
} else {
a /= Math.min(c, a / c);
total++;
}
}
if (a >= c) {
total += 2;
} else {
total++;
}
sb.append(total * b).append("\n");
}
System.out.println(sb);
}
}
htensai