結果
問題 | No.1281 Cigarette Distribution |
ユーザー | manini |
提出日時 | 2021-01-25 19:12:47 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 611 bytes |
コンパイル時間 | 926 ms |
コンパイル使用メモリ | 86,660 KB |
実行使用メモリ | 78,288 KB |
最終ジャッジ日時 | 2023-09-04 15:18:03 |
合計ジャッジ時間 | 7,347 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
71,024 KB |
testcase_01 | AC | 73 ms
70,928 KB |
testcase_02 | AC | 72 ms
70,948 KB |
testcase_03 | AC | 74 ms
70,964 KB |
testcase_04 | AC | 73 ms
70,880 KB |
testcase_05 | AC | 71 ms
70,948 KB |
testcase_06 | AC | 72 ms
70,892 KB |
testcase_07 | AC | 73 ms
71,256 KB |
testcase_08 | WA | - |
testcase_09 | AC | 73 ms
71,292 KB |
testcase_10 | AC | 80 ms
71,100 KB |
testcase_11 | AC | 71 ms
71,060 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
ソースコード
# coding:UTF-8 import sys MOD = 10 ** 9 + 7 INF = float('inf') N, M = list(map(int, input().split())) # スペース区切り連続数字 for i in range(1, M+1): base = (N + 1) // i base_plus1_count = (N + 1) - base * i base_count = i - base_plus1_count if base_plus1_count == 0: res = (base-1) * pow(base, base_count-1, MOD) % MOD else: t1 = (base-1) * pow(base, base_count-1, MOD) * pow(base+1, base_plus1_count, MOD) % MOD t2 = pow(base, base_count+1, MOD) * pow(base+1, base_plus1_count-1, MOD) % MOD res = min(t1, t2) print("{}".format(res))