結果
| 問題 |
No.1156 Nada Picnic 2
|
| ユーザー |
brthyyjp
|
| 提出日時 | 2021-07-07 19:10:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,112 ms / 2,000 ms |
| コード長 | 1,314 bytes |
| コンパイル時間 | 185 ms |
| コンパイル使用メモリ | 81,528 KB |
| 実行使用メモリ | 76,204 KB |
| 最終ジャッジ日時 | 2024-07-01 12:23:10 |
| 合計ジャッジ時間 | 2,322 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
ソースコード
n = int(input())
import itertools
if n == 1:
for p in itertools.permutations(range(10), 7):
a = str(p[0])+str(p[1])+str(p[2])
b = str(p[3])+str(p[4])+str(p[5])
c = str(p[1])+str(p[6])+str(p[2])+str(p[1])
if a[0] == '0' or b[0] == '0' or c[0] == '0':
continue
if int(a)+int(b) == int(c):
#print(a)
#print(b)
print(c)
exit()
elif n == 2:
for p in itertools.permutations(range(10), 10):
a = str(p[0])+str(p[0])+str(p[1])+str(p[2])
b = str(p[3])+str(p[4])+str(p[5])+str(p[6])
c = str(p[7])+str(p[8])+str(p[1])+str(p[2])+str(p[9])
if a[0] == '0' or b[0] == '0' or c[0] == '0':
continue
if int(a)+int(b) == int(c):
#print(a)
#print(b)
print(c)
exit()
else:
for p in itertools.permutations(range(10), 10):
a = str(p[0])+str(p[1])+str(p[2])+str(p[3])+str(p[4])+str(p[5])
b = str(p[6])+str(p[3])+str(p[5])+str(p[7])+str(p[8])
c = str(p[1])+str(p[3])+str(p[9])+str(p[4])+str(p[3])+str(p[9])
if a[0] == '0' or b[0] == '0' or c[0] == '0':
continue
if int(a)+int(b) == int(c):
#print(a)
#print(b)
print(c)
exit()
brthyyjp