結果

問題 No.915 Plus Or Multiple Operation
コンテスト
ユーザー htensai
提出日時 2020-01-22 10:23:12
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
TLE  
実行時間 -
コード長 851 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,734 ms
コンパイル使用メモリ 82,292 KB
実行使用メモリ 56,692 KB
最終ジャッジ日時 2026-05-07 12:05:58
合計ジャッジ時間 8,568 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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();
            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);
    }
}
0