結果

問題 No.358 も~っと!門松列
ユーザー takakintakakin
提出日時 2020-04-18 16:19:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 641 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-14 20:58:48
合計ジャッジ時間 1,938 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,752 KB
testcase_01 AC 30 ms
10,624 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 30 ms
10,752 KB
testcase_09 WA -
testcase_10 AC 30 ms
10,624 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 30 ms
10,752 KB
testcase_14 WA -
testcase_15 AC 29 ms
10,752 KB
testcase_16 AC 29 ms
10,752 KB
testcase_17 AC 30 ms
10,752 KB
testcase_18 AC 31 ms
10,752 KB
testcase_19 AC 29 ms
10,752 KB
testcase_20 WA -
testcase_21 AC 30 ms
10,752 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
A=[int(i) for i in input().split()]
def chk(A):
  if A[1]<A[0] and A[1]<A[2]:
    return True
  elif A[1]>A[0] and A[1]>A[2]:
    return True
  else:
    return False

def primes(n):
  is_prime=[True]*(n+1)
  is_prime[0]=False
  is_prime[1]=False
  for i in range(2,int(n**0.5)+1):
    if not is_prime[i]:
      continue
    for j in range(i*2,n+1,i):
      is_prime[j]=False
  return [i for i in range(n+1) if is_prime[i]]

if chk(A):
  print("INF")
else:
  ans=0
  P=primes(max(A))
  for p in P:
    B=[]
    for a in A:
      B.append(a%p)
    if chk(B):
      ans+=1
  print(ans)
  
0