結果

問題 No.1259 スイッチ
ユーザー t98slidert98slider
提出日時 2023-01-08 09:55:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 418 bytes
コンパイル時間 2,770 ms
コンパイル使用メモリ 138,228 KB
実行使用メモリ 7,468 KB
最終ジャッジ日時 2023-08-21 20:47:14
合計ジャッジ時間 6,324 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 14 ms
5,776 KB
testcase_11 AC 19 ms
7,000 KB
testcase_12 AC 12 ms
5,612 KB
testcase_13 AC 8 ms
4,704 KB
testcase_14 AC 11 ms
5,264 KB
testcase_15 AC 8 ms
4,688 KB
testcase_16 AC 17 ms
6,364 KB
testcase_17 AC 11 ms
5,192 KB
testcase_18 AC 20 ms
7,068 KB
testcase_19 AC 18 ms
6,924 KB
testcase_20 AC 14 ms
5,876 KB
testcase_21 AC 20 ms
7,244 KB
testcase_22 AC 7 ms
4,680 KB
testcase_23 AC 18 ms
6,764 KB
testcase_24 AC 13 ms
5,856 KB
testcase_25 AC 13 ms
5,840 KB
testcase_26 AC 21 ms
7,184 KB
testcase_27 AC 17 ms
6,588 KB
testcase_28 AC 13 ms
5,812 KB
testcase_29 AC 16 ms
6,632 KB
testcase_30 AC 11 ms
5,284 KB
testcase_31 AC 15 ms
6,204 KB
testcase_32 AC 7 ms
4,520 KB
testcase_33 AC 21 ms
7,208 KB
testcase_34 AC 12 ms
5,444 KB
testcase_35 AC 16 ms
6,312 KB
testcase_36 AC 16 ms
6,068 KB
testcase_37 AC 15 ms
5,924 KB
testcase_38 AC 13 ms
5,672 KB
testcase_39 AC 20 ms
7,048 KB
testcase_40 AC 20 ms
7,340 KB
testcase_41 AC 16 ms
6,376 KB
testcase_42 AC 20 ms
7,152 KB
testcase_43 AC 13 ms
5,764 KB
testcase_44 AC 19 ms
6,948 KB
testcase_45 AC 20 ms
7,236 KB
testcase_46 AC 13 ms
5,436 KB
testcase_47 AC 21 ms
7,244 KB
testcase_48 AC 11 ms
5,280 KB
testcase_49 AC 20 ms
7,220 KB
testcase_50 AC 13 ms
5,536 KB
testcase_51 AC 8 ms
4,540 KB
testcase_52 AC 20 ms
7,088 KB
testcase_53 AC 10 ms
4,996 KB
testcase_54 AC 20 ms
7,120 KB
testcase_55 AC 7 ms
4,472 KB
testcase_56 AC 11 ms
5,216 KB
testcase_57 AC 18 ms
6,840 KB
testcase_58 AC 14 ms
5,632 KB
testcase_59 AC 15 ms
6,192 KB
testcase_60 AC 21 ms
7,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
using namespace std;
using mint = atcoder::modint1000000007;

int main(){
  long long n, k, m;
  cin >> n >> k >> m;
  mint ans, coef = 1, pow[n + 1];
  pow[0] = 1;
  for(int i = 1; i <= n; i++)pow[i] = pow[i - 1] * n;
  for(long long i = 1; i <= n; coef *= n - i++) {
      if(k % i == 0) ans += coef * pow[n - i];
  }
  if(m != 1) ans = (pow[n] - ans) / (n - 1);
  cout << ans.val() << '\n';
}
0