結果

問題 No.2185 平方数の下6桁
ユーザー タコイモ
提出日時 2023-01-13 22:02:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 558 bytes
コンパイル時間 1,580 ms
コンパイル使用メモリ 81,936 KB
実行使用メモリ 54,300 KB
最終ジャッジ日時 2024-12-24 17:31:55
合計ジャッジ時間 3,959 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(x): #y = N+10**9
  if x == 0:
    return [0]

  if x == 1:
    return [1,9]
  if x == 2 or x == 3 or x == 7 or x == 8:
    return False
  if x == 4:
    return [2,8]
  if x == 5:
    return [5]
  if x == 6:
    return [4,6]
  if x == 9:
    return [3,7]
SS = int(input())
SS += 10**9
ans = [[] for _ in range(7)]
ans[0] = [SS]
for i in range(6):
  for S in ans[i]:
    
    A = str(S)
   
    B = f(int(A[-1]))
    
    if not B:
      continue
    for j in B:
      ans[i+1].append((S-j*j)//10)

if ans[6]:
  print('YES')
else:
  print('NO')
    
 
  
0