結果
問題 |
No.825 賢いお買い物
|
ユーザー |
|
提出日時 | 2019-07-03 14:02:54 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,271 bytes |
コンパイル時間 | 3,450 ms |
コンパイル使用メモリ | 75,492 KB |
実行使用メモリ | 36,808 KB |
最終ジャッジ日時 | 2024-09-15 06:17:11 |
合計ジャッジ時間 | 5,881 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 2 |
ソースコード
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; } }