結果
問題 |
No.358 も~っと!門松列
|
ユーザー |
![]() |
提出日時 | 2025-03-20 21:03:16 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 37 ms / 1,000 ms |
コード長 | 679 bytes |
コンパイル時間 | 224 ms |
コンパイル使用メモリ | 82,536 KB |
実行使用メモリ | 54,208 KB |
最終ジャッジ日時 | 2025-03-20 21:03:26 |
合計ジャッジ時間 | 1,792 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
a = list(map(int, input().split())) a1, a2, a3 = a def is_kadomatsu(one, two, three): if len({one, two, three}) != 3: return False max_val = max(one, two, three) min_val = min(one, two, three) return two == max_val or two == min_val if is_kadomatsu(a1, a2, a3): print("INF") else: max_p = max(a1, a2, a3) count = 0 for p in range(2, max_p + 1): b1 = a1 % p b2 = a2 % p b3 = a3 % p if b1 == b2 or b2 == b3 or b1 == b3: continue current_max = max(b1, b2, b3) current_min = min(b1, b2, b3) if b2 == current_max or b2 == current_min: count += 1 print(count)