結果

問題 No.555 世界史のレポート
ユーザー fal_rndfal_rnd
提出日時 2017-08-11 22:49:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 752 bytes
コンパイル時間 2,589 ms
コンパイル使用メモリ 82,908 KB
実行使用メモリ 58,172 KB
最終ジャッジ日時 2023-08-02 23:15:24
合計ジャッジ時間 6,069 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
55,832 KB
testcase_01 AC 128 ms
55,888 KB
testcase_02 AC 127 ms
55,916 KB
testcase_03 AC 127 ms
56,112 KB
testcase_04 AC 128 ms
56,188 KB
testcase_05 AC 128 ms
56,056 KB
testcase_06 AC 129 ms
55,860 KB
testcase_07 AC 130 ms
55,972 KB
testcase_08 AC 130 ms
56,332 KB
testcase_09 AC 130 ms
55,708 KB
testcase_10 AC 151 ms
55,964 KB
testcase_11 AC 151 ms
56,264 KB
testcase_12 AC 146 ms
56,072 KB
testcase_13 AC 145 ms
56,016 KB
testcase_14 AC 147 ms
56,152 KB
testcase_15 AC 152 ms
54,320 KB
testcase_16 AC 145 ms
55,704 KB
testcase_17 AC 153 ms
58,172 KB
testcase_18 AC 152 ms
55,876 KB
testcase_19 AC 157 ms
56,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main{
	static IntStream REPS(int v){return IntStream.range(0,v);}
	static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
	static IntStream INS(int n) {return REPS(n).map(i->getInt());}
	static Scanner s=new Scanner(System.in);
	static int getInt(){return Integer.parseInt(s.next());}
	public static void main(String[]$){
		int n=getInt();
		long c=getInt(),v=getInt();
		long[]dp=new long[n*2+1];
		Arrays.fill(dp,Long.MAX_VALUE);
		dp[1]=0;
		for(int i=1;i<=n*2;++i){
			for(int j=1;j*i+i<=n*2;++j) {
				dp[j*i+i]=Math.min(dp[j*i+i],dp[i]+c+v*j);
			}
		}
		System.out.println(REPS(n,n*2).mapToLong(i->dp[i]).min().getAsLong());
	}
}
0