結果

問題 No.2989 Fibonacci Prize
ユーザー むつあるむつある
提出日時 2024-12-14 00:47:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 470 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 140,040 KB
最終ジャッジ日時 2024-12-14 00:47:39
合計ジャッジ時間 6,457 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,524 KB
testcase_01 AC 38 ms
52,340 KB
testcase_02 AC 55 ms
71,628 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 36 ms
52,200 KB
testcase_06 WA -
testcase_07 AC 38 ms
52,532 KB
testcase_08 AC 38 ms
52,872 KB
testcase_09 AC 37 ms
52,892 KB
testcase_10 AC 37 ms
52,276 KB
testcase_11 WA -
testcase_12 AC 37 ms
52,004 KB
testcase_13 AC 41 ms
52,364 KB
testcase_14 AC 38 ms
53,004 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 38 ms
52,872 KB
testcase_18 AC 38 ms
53,292 KB
testcase_19 AC 37 ms
53,488 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 38 ms
53,076 KB
testcase_23 AC 47 ms
62,080 KB
testcase_24 AC 57 ms
72,220 KB
testcase_25 AC 59 ms
73,208 KB
testcase_26 AC 44 ms
59,228 KB
testcase_27 WA -
testcase_28 AC 49 ms
65,388 KB
testcase_29 AC 49 ms
64,800 KB
testcase_30 AC 43 ms
58,768 KB
testcase_31 AC 47 ms
61,672 KB
testcase_32 AC 45 ms
61,128 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 104 ms
139,588 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 86 ms
109,832 KB
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 86 ms
109,760 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 86 ms
109,748 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 83 ms
105,568 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 84 ms
110,288 KB
testcase_59 WA -
testcase_60 WA -
testcase_61 AC 81 ms
104,620 KB
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 AC 37 ms
52,680 KB
testcase_66 WA -
testcase_67 WA -
testcase_68 AC 37 ms
53,228 KB
testcase_69 WA -
testcase_70 WA -
testcase_71 AC 37 ms
52,556 KB
testcase_72 AC 36 ms
52,204 KB
testcase_73 AC 38 ms
53,204 KB
testcase_74 AC 38 ms
52,440 KB
testcase_75 WA -
testcase_76 AC 38 ms
53,020 KB
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())

if m<2:
  print(0)
  exit()

if n==1:
  print((m-2)*(m-3)//2+m)
  exit()

loop=[0,1]

while True:
  loop.append((loop[-1]+loop[-2]+1)%n)
  if loop[-1]==loop[-2]==0:
    break
  
loop=loop[1:]

cnt=[0]*n
cnt[0]+=1
l=len(loop)

p=(m-2)//l
for i in loop:
  cnt[i]+=p
for i in range((m-2)%l):
  cnt[loop[i]]+=1
  
ans=0
last=loop[(m-1)%l]
if last==0:
  ans+=1
last=loop[m%l]
if last==0:
  ans+=1
  
for i in cnt:
  ans+=i*(i-1)//2
  
print(ans)
0