結果
| 問題 | 
                            No.825 賢いお買い物
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-07-03 12:59:05 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,357 bytes | 
| コンパイル時間 | 3,513 ms | 
| コンパイル使用メモリ | 75,856 KB | 
| 実行使用メモリ | 36,976 KB | 
| 最終ジャッジ日時 | 2024-09-14 19:54:31 | 
| 合計ジャッジ時間 | 5,516 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | WA * 19 | 
ソースコード
package test.demo;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Yukicoder825 {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		while(true) {
		System.out.println("三つの数字を入力してください,空白切で");
		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		try {
			String str=bf.readLine();
			
			String[] str2=str.split(" ");
			if(str2.length==3) {
			int a=Integer.parseInt(str2[0]);
			int b=Integer.parseInt(str2[1]);
			int c=Integer.parseInt(str2[2]);
			if(new Yukicoder825().test(a,b,c)==-1) {
				System.out.println("ありえない");
			}else {
			System.out.println(new Yukicoder825().test(a,b,c));
			}
			
			}else {
				throw new IOException();
			}
			
			return;
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			System.out.println("5桁まで入力ください");
			//e.printStackTrace();
		}
		
		}
	}
	
	public int test(int a,int b, int c) {
		int endmoney=0;
		//使った枚数.
		int d;
		d=a+b-c;
		
		 if(d<=0){
			return -1;
		}else if(d>a) {
			return a+(d-a)*10;
		}
		 else{
			//使った枚数
			if(a%10!=0) {
				return (a-(c-(a/10+b)))%10;
			}else {
				return (a-(c-(a/10-1+b)))%10;
			}
		}
		
		//return endmoney;
		
	}
}