結果

問題 No.51 やる気の問題
ユーザー ちよちゃんちよちゃん
提出日時 2016-05-30 17:41:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 146 ms / 5,000 ms
コード長 504 bytes
コンパイル時間 4,321 ms
コンパイル使用メモリ 74,588 KB
実行使用メモリ 41,664 KB
最終ジャッジ日時 2024-04-16 18:46:34
合計ジャッジ時間 7,845 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
41,424 KB
testcase_01 AC 140 ms
41,240 KB
testcase_02 AC 136 ms
41,320 KB
testcase_03 AC 136 ms
41,280 KB
testcase_04 AC 138 ms
41,664 KB
testcase_05 AC 145 ms
41,652 KB
testcase_06 AC 142 ms
41,640 KB
testcase_07 AC 143 ms
41,596 KB
testcase_08 AC 141 ms
41,448 KB
testcase_09 AC 143 ms
41,412 KB
testcase_10 AC 141 ms
41,384 KB
testcase_11 AC 139 ms
41,604 KB
testcase_12 AC 142 ms
41,576 KB
testcase_13 AC 146 ms
41,584 KB
testcase_14 AC 144 ms
41,528 KB
testcase_15 AC 145 ms
41,196 KB
testcase_16 AC 141 ms
41,524 KB
testcase_17 AC 136 ms
41,304 KB
testcase_18 AC 142 ms
41,364 KB
testcase_19 AC 144 ms
41,408 KB
testcase_20 AC 141 ms
41,324 KB
testcase_21 AC 140 ms
41,584 KB
testcase_22 AC 142 ms
41,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class Yuki51 {
	
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int d = scan.nextInt();
		scan.close();
		for(int i = d; i>0; i--){
			if(i == 1) {
				System.out.println(w);
				break;
			}
			try {
				double num = Math.floor((double)w/((double)i*(double)i));
				w -= (int)num;				
			} catch (Exception e) {
				// TODO: handle exception
				System.out.println(e);
			}

		}
	}
}
0