結果

問題 No.825 賢いお買い物
ユーザー heyanxxheyanxx
提出日時 2019-07-03 14:02:54
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,271 bytes
コンパイル時間 3,256 ms
コンパイル使用メモリ 74,256 KB
実行使用メモリ 49,648 KB
最終ジャッジ日時 2023-10-13 09:09:11
合計ジャッジ時間 6,098 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,336 KB
testcase_01 AC 45 ms
49,180 KB
testcase_02 AC 43 ms
49,188 KB
testcase_03 AC 43 ms
49,196 KB
testcase_04 AC 43 ms
49,292 KB
testcase_05 WA -
testcase_06 AC 42 ms
49,068 KB
testcase_07 AC 43 ms
49,200 KB
testcase_08 AC 43 ms
49,276 KB
testcase_09 AC 43 ms
49,376 KB
testcase_10 AC 43 ms
49,260 KB
testcase_11 AC 44 ms
49,296 KB
testcase_12 WA -
testcase_13 AC 43 ms
49,304 KB
testcase_14 AC 43 ms
49,260 KB
testcase_15 AC 43 ms
49,524 KB
testcase_16 AC 43 ms
49,260 KB
testcase_17 AC 43 ms
49,172 KB
testcase_18 AC 44 ms
49,256 KB
testcase_19 AC 44 ms
49,228 KB
testcase_20 AC 43 ms
49,184 KB
testcase_21 AC 43 ms
49,332 KB
権限があれば一括ダウンロードができます

ソースコード

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) {
		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("Impossible");
			}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