結果

問題 No.176 2種類の切手
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-04-04 08:53:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 1,000 ms
コード長 1,015 bytes
コンパイル時間 3,530 ms
コンパイル使用メモリ 77,824 KB
実行使用メモリ 41,784 KB
最終ジャッジ日時 2024-04-16 22:05:48
合計ジャッジ時間 8,515 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
40,136 KB
testcase_01 AC 128 ms
41,376 KB
testcase_02 AC 130 ms
41,376 KB
testcase_03 AC 125 ms
40,988 KB
testcase_04 AC 121 ms
41,060 KB
testcase_05 AC 118 ms
40,016 KB
testcase_06 AC 120 ms
40,160 KB
testcase_07 AC 122 ms
40,996 KB
testcase_08 AC 122 ms
41,132 KB
testcase_09 AC 128 ms
41,328 KB
testcase_10 AC 130 ms
41,332 KB
testcase_11 AC 125 ms
41,292 KB
testcase_12 AC 122 ms
41,784 KB
testcase_13 AC 121 ms
39,892 KB
testcase_14 AC 126 ms
41,676 KB
testcase_15 AC 112 ms
41,436 KB
testcase_16 AC 133 ms
41,240 KB
testcase_17 AC 136 ms
40,976 KB
testcase_18 AC 120 ms
41,112 KB
testcase_19 AC 113 ms
41,736 KB
testcase_20 AC 108 ms
40,152 KB
testcase_21 AC 120 ms
40,040 KB
testcase_22 AC 123 ms
41,280 KB
testcase_23 AC 125 ms
41,084 KB
testcase_24 AC 125 ms
41,184 KB
testcase_25 AC 112 ms
40,184 KB
testcase_26 AC 121 ms
41,004 KB
testcase_27 AC 118 ms
40,356 KB
testcase_28 AC 113 ms
40,140 KB
testcase_29 AC 118 ms
41,560 KB
testcase_30 AC 119 ms
39,968 KB
testcase_31 AC 122 ms
40,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//No.176 2種類の切手

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class No176 {
    
    static final Scanner sc = new Scanner(System.in);
    static final PrintWriter out = new PrintWriter(System.out,false);

    static void solve() {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int t = sc.nextInt();
        long min = Long.MAX_VALUE;
        if (a > b) {
            int temp = a; a = b; b = temp;
        }

        for (int i=0; ; i++) {
            int j = (t-b*i+a-1)/a;
            min = min(min,b*i+a*j);
            if (b*i > t || i > a) break;
        }

        out.println(min);
    }

    public static void main(String[] args) {
        long start = System.currentTimeMillis();

        solve();
        out.flush();

        long end = System.currentTimeMillis();
        //trace(end-start + "ms");
        sc.close();
    }

    static void trace(Object... o) { System.out.println(deepToString(o));}
}
0