結果
| 問題 | 
                            No.63 ポッキーゲーム
                             | 
                    
| コンテスト | |
| ユーザー | 
                             r.suzuki
                         | 
                    
| 提出日時 | 2016-01-25 01:17:17 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1,013 ms / 5,000 ms | 
| コード長 | 698 bytes | 
| コンパイル時間 | 3,798 ms | 
| コンパイル使用メモリ | 74,004 KB | 
| 実行使用メモリ | 41,264 KB | 
| 最終ジャッジ日時 | 2024-12-24 05:01:03 | 
| 合計ジャッジ時間 | 10,046 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 | 
ソースコード
class Human{
	int eatLength;
	int eatedPokkey;
	
	public Human(int i){
		this.eatLength = i;
		this.eatedPokkey = 0;
	}
}
public class No_63{
	public static void main(String[] args){
		java.util.Scanner sc = new java.util.Scanner(System.in);
		int pokkey = sc.nextInt();
		int k = sc.nextInt();
		
		Human haruka = new Human(k);
		Human yuu = new Human(k);
		
		while(pokkey > 0){
			if(pokkey - (haruka.eatLength + yuu.eatLength) > 0){
				haruka.eatedPokkey += haruka.eatLength;
				yuu.eatedPokkey += yuu.eatLength;
				pokkey -= haruka.eatLength + yuu.eatLength;
			}
			else{
				haruka.eatedPokkey += pokkey;
				pokkey = 0;
			}
		}
		System.out.println(yuu.eatedPokkey);
		sc.close();
	}
}
            
            
            
        
            
r.suzuki