結果
問題 | No.3034 7 problems |
ユーザー | fura |
提出日時 | 2023-09-18 17:29:16 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 661 ms / 2,000 ms |
コード長 | 5,308 bytes |
コンパイル時間 | 108 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 22,656 KB |
最終ジャッジ日時 | 2024-07-05 07:36:35 |
合計ジャッジ時間 | 31,443 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 470 ms
22,400 KB |
testcase_01 | AC | 456 ms
22,400 KB |
testcase_02 | AC | 580 ms
22,400 KB |
testcase_03 | AC | 497 ms
22,400 KB |
testcase_04 | AC | 502 ms
22,400 KB |
testcase_05 | AC | 563 ms
22,272 KB |
testcase_06 | AC | 542 ms
22,528 KB |
testcase_07 | AC | 549 ms
22,400 KB |
testcase_08 | AC | 538 ms
22,400 KB |
testcase_09 | AC | 565 ms
22,400 KB |
testcase_10 | AC | 500 ms
22,400 KB |
testcase_11 | AC | 535 ms
22,400 KB |
testcase_12 | AC | 511 ms
22,400 KB |
testcase_13 | AC | 532 ms
22,400 KB |
testcase_14 | AC | 523 ms
22,400 KB |
testcase_15 | AC | 530 ms
22,400 KB |
testcase_16 | AC | 527 ms
22,400 KB |
testcase_17 | AC | 527 ms
22,400 KB |
testcase_18 | AC | 607 ms
22,528 KB |
testcase_19 | AC | 534 ms
22,656 KB |
testcase_20 | AC | 557 ms
22,272 KB |
testcase_21 | AC | 490 ms
22,528 KB |
testcase_22 | AC | 572 ms
22,528 KB |
testcase_23 | AC | 526 ms
22,400 KB |
testcase_24 | AC | 586 ms
22,656 KB |
testcase_25 | AC | 574 ms
22,528 KB |
testcase_26 | AC | 490 ms
22,528 KB |
testcase_27 | AC | 621 ms
22,400 KB |
testcase_28 | AC | 564 ms
22,400 KB |
testcase_29 | AC | 546 ms
22,400 KB |
testcase_30 | AC | 483 ms
22,400 KB |
testcase_31 | AC | 566 ms
22,400 KB |
testcase_32 | AC | 516 ms
22,528 KB |
testcase_33 | AC | 559 ms
22,400 KB |
testcase_34 | AC | 489 ms
22,272 KB |
testcase_35 | AC | 661 ms
22,400 KB |
testcase_36 | AC | 533 ms
22,528 KB |
testcase_37 | AC | 490 ms
22,400 KB |
testcase_38 | AC | 555 ms
22,400 KB |
testcase_39 | AC | 572 ms
22,400 KB |
testcase_40 | AC | 588 ms
22,272 KB |
testcase_41 | AC | 508 ms
22,528 KB |
testcase_42 | AC | 558 ms
22,400 KB |
testcase_43 | AC | 601 ms
22,400 KB |
testcase_44 | AC | 495 ms
22,400 KB |
testcase_45 | AC | 527 ms
22,400 KB |
testcase_46 | AC | 506 ms
22,400 KB |
testcase_47 | AC | 511 ms
22,400 KB |
testcase_48 | AC | 504 ms
22,400 KB |
testcase_49 | AC | 590 ms
22,272 KB |
testcase_50 | AC | 506 ms
22,400 KB |
testcase_51 | AC | 500 ms
22,400 KB |
testcase_52 | AC | 455 ms
22,400 KB |
ソースコード
MOD = int(1e9 + 7) modfact = [1] * 100001 for i in range(100000): modfact[i + 1] = modfact[i] * (i + 1) % MOD def modinv(n): return pow(n, MOD - 2, MOD) # s = '100111011000111101000110111111101011110100110010111011101101110110111011011111100111111010111100101100001110011011101011100111110000111000011110010111010101011101101000110000111010101101001110110111001010101100110101111011111101110110111111001111110101111001011000011100110111010111011101101001110100011000011101000110010111011101101110110011111000011101110110000111010010101110110101111011111101110110111111001111110101111001011000011100110111010111011101101001100111001011010110001110101111000011101001111001111011111110101111001111000011110011111010111100101110101010111010010011101011110000111010011101101110010111011101101111111001111011111110101111001111000011100100110010111010001100001101101101100010101100100100110111011101110110111111010001100001110111011011101101001110010011001011101001110001111010001101001111100111011111110101111001011000011101110110111011100111110101111010111101111101111110110111011111100011110100011010011101001111010011001011110011110010111010011110011111010111101011000001111011111011111110011110010111010011110011110010111010011110011110100011010010101100110001111010001101111111010111101001100101110111011011101001001010101101100011110100110111111000111101000110111111101011110100110010111011101101110100000111011101101111110000111010011100100110000111011101101001110100011001011101110110111011101111101111111010011100111110101110100111010111100001111001111101011110010111010101011101110011110111111101011110011110000111001111100001110111111101111100001111010011101001100001110000111101001101111110111011010011101000110000111010111101001110011111000011100100110010111010111101001111010011001011101001111001011101010101110110101111011111101011110111111001001100101010110011010111101001110111011011111110011111010111010111101111110000111101111101111010110001100101101001110101011011111110101100111011010011101011110000111011101101111111001111101011100010110010111101001100101110111011011111110011110010111010011110011111010111101011001010110111011010011110100111001111101011101001111010011001011101110110111111000111101000110111111101011110100110010111011101101110011000111101001101111110001111010001101111111010111101001100101110111011011101001010110111011011111101011111100111011111110010110100111011101101111111001111011111110101111011111000011110100110111111101001100101110100111001111101001111001111101011110010111010101011101110010110000111011101101110110010011000011101101111010111011101101001110101111011111110101111001111001011101001111001111000011110010110010111100101110101110101111010011101110110111111100111110101110101111011111100001110111011011111101011110100111101001100001110100111000111101000110100111101111101111101100011101001101111111001111010001101001111010011000011110100110111111010111101001010110010011100100001101100011101111101111011000101100001011110011100101010110110111110010011001011110111110000111101001110100110000111000011101101110000111100101101001111011111011111101101110111111101001101111110110111001011101110110000111100111100001110100101011101110100110000111001001100001111001111010001101001010110011010111101111110111011011111100001111010011000011101001110100011000011101011110000111011101100001111001011000011111010111010111100111100101110100111100111110101111010111011101101001110111011000011110010111010111010111101111111010011011111100111110000111100111101000110111111101011101101110010111010011100100110010111010111101001111001011101010101110' # while s != '': # print(chr(int(s[:7], base=2)), end='') # s = s[7:] # Nchoutennnogurafugaaru. # hajime,konogurafunihahennganai. # konogurafuniN-1kaisousasuru. # Ikaimenosousadeha[1,I]nohannideichiyourannsuuwomochiiteseisuuAwoseiseishi, # choutennI+1tochoutennAnoaidanihennwotsuikasuru. # sousagaowattaatonihakigadekiteiru. # kokode,kinosukoawo,2ijouNikanosubetenoseisuuJnitsuitenochoutenn1tochoutennJnokyorinosouwatoteigisuru. # ranndamunikouseisarerukinosukoanokitaichiwoXtoshitatoki, # N!Xwo10^9+7dewattaamariwomotomenasai. # tadashi,konoataihakanarazuseisuuninarukotogashoumeidekiru. # n = 3 # score sum = 5 # 1 - 2 - 3 : 3 # 1 - 2 : 2 # \ 3 # n = 4 # score sum = 26 # 1 - 2 - 3 - 4 : 6 # 1 - 2 - 3 : 5 # \ 4 # 1 - 2 - 3 : 4 # \ 4 # 1 - 2 - 4 : 4 # \ 3 # 1 - 2 : 4 # \ 3 - 4 # 1 - 2 : 3 # \ 3 # \ 4 dp = [0] * 100000 # dp[i] = (頂点 i と頂点 1 との距離の期待値) cum = [0] * 100001 # cum[i] = dp[0] + ... + dp[i - 1] for i in range(1, 100000): dp[i] = (cum[i] * modinv(i) + 1) % MOD cum[i + 1] = (cum[i] + dp[i]) % MOD t = -1 # number of test cases def question1(n): return n * n def question2(n): return (n ** 3 - n) * 1 + n * n def question3(n): return t def question4(n): return 4 * n ** 2 + 17 def question5(n): return pow(n, n ** 3, MOD) def question6(n): return n def question7(n): return cum[n] * modfact[n] % MOD t = int(input()) for i in range(t): n = int(input()) if i > 0: print() print(question1(n)) print(question2(n)) print(question3(n)) print(question4(n)) print(question5(n)) print(question6(n)) print(question7(n))