結果

問題 No.51 やる気の問題
ユーザー htensaihtensai
提出日時 2019-12-06 16:36:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 348 bytes
コンパイル時間 2,120 ms
コンパイル使用メモリ 71,624 KB
実行使用メモリ 57,892 KB
最終ジャッジ日時 2023-08-24 22:54:33
合計ジャッジ時間 6,181 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,692 KB
testcase_01 AC 122 ms
55,940 KB
testcase_02 AC 121 ms
55,780 KB
testcase_03 AC 123 ms
55,708 KB
testcase_04 AC 123 ms
55,644 KB
testcase_05 AC 129 ms
55,812 KB
testcase_06 AC 125 ms
55,988 KB
testcase_07 AC 120 ms
55,936 KB
testcase_08 AC 123 ms
57,892 KB
testcase_09 AC 123 ms
55,412 KB
testcase_10 AC 123 ms
55,880 KB
testcase_11 AC 123 ms
55,936 KB
testcase_12 AC 123 ms
55,976 KB
testcase_13 AC 125 ms
56,004 KB
testcase_14 AC 123 ms
56,004 KB
testcase_15 AC 125 ms
56,244 KB
testcase_16 AC 122 ms
55,896 KB
testcase_17 AC 122 ms
56,064 KB
testcase_18 AC 125 ms
56,364 KB
testcase_19 AC 126 ms
56,228 KB
testcase_20 AC 125 ms
56,064 KB
testcase_21 AC 124 ms
55,676 KB
testcase_22 AC 130 ms
55,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int d = sc.nextInt();
		int[] arr = new int[d + 1];
		arr[d] = w;
		for (int i = d; i > 1; i--) {
		    arr[i - 1] = (int)(arr[i] - arr[i] / ((long)i * i));
		}
		System.out.println(arr[1]);
   }
}

0