結果

問題 No.555 世界史のレポート
ユーザー fal_rndfal_rnd
提出日時 2017-08-11 22:49:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 752 bytes
コンパイル時間 2,186 ms
コンパイル使用メモリ 82,072 KB
実行使用メモリ 54,456 KB
最終ジャッジ日時 2024-04-20 23:09:30
合計ジャッジ時間 5,386 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
54,084 KB
testcase_01 AC 110 ms
53,112 KB
testcase_02 AC 119 ms
53,984 KB
testcase_03 AC 106 ms
53,208 KB
testcase_04 AC 116 ms
54,016 KB
testcase_05 AC 117 ms
54,288 KB
testcase_06 AC 121 ms
54,104 KB
testcase_07 AC 118 ms
53,896 KB
testcase_08 AC 104 ms
53,204 KB
testcase_09 AC 116 ms
54,456 KB
testcase_10 AC 139 ms
54,136 KB
testcase_11 AC 123 ms
53,124 KB
testcase_12 AC 140 ms
54,056 KB
testcase_13 AC 119 ms
53,308 KB
testcase_14 AC 136 ms
53,388 KB
testcase_15 AC 126 ms
53,064 KB
testcase_16 AC 132 ms
54,300 KB
testcase_17 AC 139 ms
54,032 KB
testcase_18 AC 136 ms
54,136 KB
testcase_19 AC 147 ms
54,140 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