結果
| 問題 | No.825 賢いお買い物 | 
| コンテスト | |
| ユーザー |  brthyyjp | 
| 提出日時 | 2021-05-06 19:15:19 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 53 ms / 2,000 ms | 
| コード長 | 383 bytes | 
| コンパイル時間 | 278 ms | 
| コンパイル使用メモリ | 82,176 KB | 
| 実行使用メモリ | 60,928 KB | 
| 最終ジャッジ日時 | 2024-09-14 10:33:51 | 
| 合計ジャッジ時間 | 2,183 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 | 
ソースコード
a, b, c = map(int, input().split())
ans = 10**18
for i in range(a+1):
    for j in range(b+1):
        x = i+10*j
        if x == 0:
            continue
        R = a-i+b-j
        for y in range(1, x+1):
            z = x-y
            q, r = divmod(z, 10)
            if R+q+r == c:
                ans = min(ans, y)
if ans != 10**18:
    print(ans)
else:
    print('Impossible')
            
            
            
        