結果
問題 |
No.825 賢いお買い物
|
ユーザー |
![]() |
提出日時 | 2019-05-03 21:46:10 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 129 ms / 2,000 ms |
コード長 | 705 bytes |
コンパイル時間 | 2,088 ms |
コンパイル使用メモリ | 74,892 KB |
実行使用メモリ | 54,340 KB |
最終ジャッジ日時 | 2024-12-31 17:45:58 |
合計ジャッジ時間 | 5,892 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); sc.close(); if (b == 0) { if (a <= c) { System.out.println("Impossible"); return; } } else { if (a + b + 8 < c) { System.out.println("Impossible"); return; } } if (b >= c && a != 0) { System.out.println(10 * (b - c) + a); } else { if (a + b > c) { while (a >= 10 && a + b - c >= 10) { a -= 10; b++; } System.out.println(a + b - c); } else { a += 9; b--; System.out.println(a + b - c + 1); } } } }