結果

問題 No.176 2種類の切手
ユーザー 37zigen37zigen
提出日時 2016-04-12 12:35:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 1,000 ms
コード長 465 bytes
コンパイル時間 2,122 ms
コンパイル使用メモリ 75,120 KB
実行使用メモリ 41,600 KB
最終ジャッジ日時 2024-04-16 22:20:56
合計ジャッジ時間 7,486 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
41,544 KB
testcase_01 AC 133 ms
41,204 KB
testcase_02 AC 134 ms
41,600 KB
testcase_03 AC 136 ms
41,312 KB
testcase_04 AC 136 ms
41,280 KB
testcase_05 AC 134 ms
41,184 KB
testcase_06 AC 134 ms
41,480 KB
testcase_07 AC 135 ms
41,532 KB
testcase_08 AC 134 ms
41,340 KB
testcase_09 AC 134 ms
41,288 KB
testcase_10 AC 135 ms
41,364 KB
testcase_11 AC 135 ms
41,352 KB
testcase_12 AC 135 ms
41,204 KB
testcase_13 AC 132 ms
41,468 KB
testcase_14 AC 131 ms
41,316 KB
testcase_15 AC 136 ms
41,284 KB
testcase_16 AC 135 ms
41,288 KB
testcase_17 AC 133 ms
41,368 KB
testcase_18 AC 133 ms
41,188 KB
testcase_19 AC 136 ms
41,532 KB
testcase_20 AC 135 ms
41,300 KB
testcase_21 AC 134 ms
41,460 KB
testcase_22 AC 119 ms
40,532 KB
testcase_23 AC 131 ms
41,400 KB
testcase_24 AC 134 ms
41,416 KB
testcase_25 AC 135 ms
41,332 KB
testcase_26 AC 135 ms
41,240 KB
testcase_27 AC 134 ms
41,520 KB
testcase_28 AC 135 ms
41,312 KB
testcase_29 AC 122 ms
40,140 KB
testcase_30 AC 121 ms
40,212 KB
testcase_31 AC 132 ms
41,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;
import java.util.*;
public class Main{
	public static void main(String[] args)throws Exception{
		new Main().solve();
	}
	void solve(){
		Scanner sc=new Scanner(System.in);
		long a=sc.nextLong();
		long b=sc.nextLong();
		long n=sc.nextLong();
		
		long min=999999999999L;
		if(a<b){
			long d=a;
			a=b;
			b=d;
		}
		for(int i=0;i<=b;i++){
			min=Math.min(a*i+((n-a*i+b-1)/b)*b, min);
			if(a*i>n)break;
		}
		
		System.out.println(min);
	}
}
0