結果
| 問題 |
No.825 賢いお買い物
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-07-04 15:18:55 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,099 bytes |
| コンパイル時間 | 3,739 ms |
| コンパイル使用メモリ | 76,236 KB |
| 実行使用メモリ | 37,268 KB |
| 最終ジャッジ日時 | 2024-09-19 03:56:49 |
| 合計ジャッジ時間 | 4,831 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 8 |
ソースコード
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 自動生成されたメソッド・スタブ
try {
String[]str2=input();
int a=Integer.parseInt(str2[0]);
int b=Integer.parseInt(str2[1]);
int c=Integer.parseInt(str2[2]);
if(test(a,b,c)<=0) {
System.out.println("Impossible");
}else {
System.out.println(test(a,b,c));
}
} catch (IOException e) {
}
}
public static int test(int a,int b, int c) {
int count =a+b*10;
int pay=0;
int en=0;
for(int i=c;i>=0;i--) {
if(count-((c-i)*10+i)<=0 || ((c-i))*10+i<=0) {
continue;
}
pay=(count-((c-i)*10+i));
en=i;
}
if(b-(c-en)>1) {
return -1;
}
return pay;
//(a-(c-(a/10-1+b)))%10;
}
public static String[] input() throws IOException {
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
String str=br.readLine();
String[]str2=str.split(" ");
return str2;
}
}