結果
| 問題 | 
                            No.395 永遠の17歳
                             | 
                    
| コンテスト | |
| ユーザー | 
                             iad_2889
                         | 
                    
| 提出日時 | 2019-05-20 05:31:20 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 28 ms / 1,000 ms | 
| コード長 | 275 bytes | 
| コンパイル時間 | 73 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-09-17 06:38:12 | 
| 合計ジャッジ時間 | 1,224 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 17 | 
ソースコード
def is_17(num,n):
    if not num:
        return False
    if num % n != 7:
        return False
    num//=n
    return num % n == 1 and not num // n
N = int(input())
ex = 2
ans = -1
while not is_17(N,ex):
    ex+=1
    if ex >= N:
        break
else:
    ans = ex
print(ans)
            
            
            
        
            
iad_2889