結果
| 問題 | No.587 七対子 |
| コンテスト | |
| ユーザー |
r_ishida
|
| 提出日時 | 2026-01-16 07:12:01 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 44 ms / 2,000 ms |
| コード長 | 767 bytes |
| 記録 | |
| コンパイル時間 | 460 ms |
| コンパイル使用メモリ | 82,456 KB |
| 実行使用メモリ | 54,196 KB |
| 最終ジャッジ日時 | 2026-01-16 07:12:05 |
| 合計ジャッジ時間 | 3,707 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
import math
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
s_set = set(list(s))
if len(s_set) != 7:
print("Impossible")
else:
flag = 0
for i in s_set:
if s.count(i) == 2:
continue
elif s.count(i) > 2:
print("Impossible")
break
elif s.count(i) == 1:
if flag == 1:
print("Impossible")
break
else:
ans = i
flag = 1
else:
print(ans)
r_ishida