結果
| 問題 | 
                            No.358 も~っと!門松列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             iad_2889
                         | 
                    
| 提出日時 | 2019-05-21 02:01:47 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 34 ms / 1,000 ms | 
| コード長 | 489 bytes | 
| コンパイル時間 | 85 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-09-17 08:42:40 | 
| 合計ジャッジ時間 | 1,673 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 23 | 
ソースコード
def is_kadomatsu(lst):
    if len(set(lst)) != 3:
        return False
    return min(lst) == lst[1] or max(lst) == lst[1]
lst = list(map(int,input().split()))
i = 2
cnt = 0
t_chain = 0
f_chain = 0
while True:
    if is_kadomatsu([x % i for x in lst]):
        cnt+=1
        t_chain+=1
        f_chain = 0
    else:
        f_chain+=1
        t_chain = 0
    if t_chain >= 1000 or f_chain >= 1000:
        break
    i+=1
if t_chain >= 1000:
    ans = "INF"
else:
    ans = cnt
print(ans)
            
            
            
        
            
iad_2889