結果

問題 No.51 やる気の問題
ユーザー ちよちゃん
提出日時 2016-05-30 17:41:27
言語 Java
(openjdk 23)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 504 bytes
コンパイル時間 4,172 ms
コンパイル使用メモリ 78,332 KB
実行使用メモリ 41,820 KB
最終ジャッジ日時 2024-10-07 18:50:02
合計ジャッジ時間 7,409 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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