結果

問題 No.555 世界史のレポート
ユーザー fal_rndfal_rnd
提出日時 2017-08-11 22:46:59
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 2,309 ms
コンパイル使用メモリ 84,300 KB
実行使用メモリ 42,392 KB
最終ジャッジ日時 2024-04-20 23:07:17
合計ジャッジ時間 5,697 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
41,696 KB
testcase_01 AC 126 ms
41,592 KB
testcase_02 AC 126 ms
41,588 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

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