結果

問題 No.825 賢いお買い物
ユーザー hedwig100
提出日時 2020-04-20 22:09:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 537 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-06 09:19:55
合計ジャッジ時間 1,845 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = 10 ** 9
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from  collections import deque

def main():
    a,b,c = map(int,input().split())
    ans = INF
    for i in range(1,a + 10 * b + 1):
        for j in range(a + 1):
            for k in range(b + 1):
                if j + 10 * k - i >= 0 and a - j + b - k + sum(divmod(j + 10 * k - i,10)) == c:
                    ans = min(ans,i)
    if ans == INF:
        print('Impossible')
    else:
        print(ans)

if __name__ == '__main__':
    main() 
0