結果

問題 No.51 やる気の問題
ユーザー shinshin
提出日時 2022-05-17 07:45:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 53 ms / 5,000 ms
コード長 760 bytes
コンパイル時間 5,496 ms
コンパイル使用メモリ 73,248 KB
実行使用メモリ 49,560 KB
最終ジャッジ日時 2023-10-13 03:40:33
合計ジャッジ時間 7,864 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,028 KB
testcase_01 AC 44 ms
49,560 KB
testcase_02 AC 44 ms
49,080 KB
testcase_03 AC 44 ms
49,316 KB
testcase_04 AC 43 ms
47,236 KB
testcase_05 AC 49 ms
49,184 KB
testcase_06 AC 48 ms
49,292 KB
testcase_07 AC 48 ms
49,492 KB
testcase_08 AC 47 ms
49,176 KB
testcase_09 AC 53 ms
49,356 KB
testcase_10 AC 49 ms
49,296 KB
testcase_11 AC 48 ms
49,052 KB
testcase_12 AC 49 ms
48,948 KB
testcase_13 AC 48 ms
49,200 KB
testcase_14 AC 47 ms
49,012 KB
testcase_15 AC 50 ms
49,288 KB
testcase_16 AC 45 ms
49,064 KB
testcase_17 AC 45 ms
49,080 KB
testcase_18 AC 50 ms
49,152 KB
testcase_19 AC 50 ms
49,060 KB
testcase_20 AC 48 ms
49,356 KB
testcase_21 AC 44 ms
49,284 KB
testcase_22 AC 53 ms
49,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class No51 {

	public static void main(String[] args) throws IOException{
		//やる気の問題
		String[] text = readStr();
		long W = Integer.parseInt(text[0]) , D = Integer.parseInt(text[1]);
		while(D > 1){
			W = W - Math.floorDiv(W, D * D);
			D--;
		}
		
		System.out.println(W);

	}
	
	public static String[] readStr() throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> list = new ArrayList<>();

		do {
			list.add(br.readLine());
		}while(br.ready());

		br.close();

		String[] text = new String[list.size()];
		list.toArray(text);

		return text;

	}

}
0