結果

問題 No.825 賢いお買い物
ユーザー heyanxxheyanxx
提出日時 2019-07-03 12:59:05
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,357 bytes
コンパイル時間 4,051 ms
コンパイル使用メモリ 73,532 KB
実行使用メモリ 49,612 KB
最終ジャッジ日時 2023-10-12 21:37:01
合計ジャッジ時間 5,883 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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;
		
	}

}
0