結果
問題 | No.587 七対子 |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:06:27 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 37 ms / 2,000 ms |
コード長 | 566 bytes |
コンパイル時間 | 185 ms |
コンパイル使用メモリ | 82,404 KB |
実行使用メモリ | 53,592 KB |
最終ジャッジ日時 | 2025-03-20 21:06:34 |
合計ジャッジ時間 | 2,424 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
s = input().strip() counts = [0] * 26 for c in s: counts[ord(c) - ord('a')] += 1 # Check if any character appears more than twice if any(c > 2 for c in counts): print("Impossible") else: k = sum(1 for c in counts if c == 2) m = sum(1 for c in counts if c == 1) total_non_zero = k + m if k == 6 and m == 1 and total_non_zero == 7: # Find the character that occurs once for i in range(26): if counts[i] == 1: print(chr(ord('a') + i)) break else: print("Impossible")