結果

問題 No.741 AscNumber(Easy)
ユーザー kk
提出日時 2020-09-24 00:49:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 785 bytes
コンパイル時間 2,044 ms
コンパイル使用メモリ 199,040 KB
実行使用メモリ 20,800 KB
最終ジャッジ日時 2023-09-10 13:15:48
合計ジャッジ時間 14,600 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 190 ms
20,616 KB
testcase_01 AC 190 ms
20,604 KB
testcase_02 AC 189 ms
20,484 KB
testcase_03 AC 189 ms
20,576 KB
testcase_04 AC 191 ms
20,616 KB
testcase_05 AC 189 ms
20,532 KB
testcase_06 AC 189 ms
20,520 KB
testcase_07 AC 191 ms
20,608 KB
testcase_08 AC 189 ms
20,736 KB
testcase_09 AC 190 ms
20,572 KB
testcase_10 AC 189 ms
20,544 KB
testcase_11 AC 190 ms
20,656 KB
testcase_12 AC 189 ms
20,484 KB
testcase_13 AC 189 ms
20,524 KB
testcase_14 AC 189 ms
20,540 KB
testcase_15 AC 189 ms
20,784 KB
testcase_16 AC 189 ms
20,684 KB
testcase_17 AC 190 ms
20,508 KB
testcase_18 AC 190 ms
20,576 KB
testcase_19 AC 190 ms
20,740 KB
testcase_20 AC 189 ms
20,736 KB
testcase_21 AC 190 ms
20,800 KB
testcase_22 AC 191 ms
20,704 KB
testcase_23 AC 190 ms
20,616 KB
testcase_24 AC 189 ms
20,604 KB
testcase_25 AC 189 ms
20,508 KB
testcase_26 AC 190 ms
20,508 KB
testcase_27 AC 190 ms
20,604 KB
testcase_28 AC 189 ms
20,516 KB
testcase_29 AC 189 ms
20,540 KB
testcase_30 AC 190 ms
20,572 KB
testcase_31 AC 189 ms
20,572 KB
testcase_32 AC 190 ms
20,556 KB
testcase_33 AC 190 ms
20,524 KB
testcase_34 AC 189 ms
20,544 KB
testcase_35 AC 190 ms
20,512 KB
testcase_36 AC 189 ms
20,588 KB
testcase_37 AC 190 ms
20,612 KB
testcase_38 AC 189 ms
20,508 KB
testcase_39 AC 189 ms
20,544 KB
testcase_40 AC 190 ms
20,796 KB
testcase_41 AC 189 ms
20,524 KB
testcase_42 AC 189 ms
20,600 KB
testcase_43 AC 190 ms
20,708 KB
testcase_44 AC 189 ms
20,504 KB
testcase_45 AC 190 ms
20,560 KB
testcase_46 AC 190 ms
20,532 KB
testcase_47 AC 190 ms
20,608 KB
testcase_48 AC 190 ms
20,504 KB
testcase_49 AC 190 ms
20,540 KB
testcase_50 AC 189 ms
20,512 KB
testcase_51 AC 190 ms
20,584 KB
testcase_52 AC 190 ms
20,600 KB
testcase_53 AC 190 ms
20,508 KB
testcase_54 AC 189 ms
20,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

const long long MOD = 1e9 + 7;

long long f[1100000];
long long g[1100000];

long long comb(long long n, long long r) {
  return f[n] * g[r] % MOD * g[n-r] % MOD;
}

long long homo(long long n, long long r) {
  return comb(n+r-1, r);
}

long long modpow(long long x, long long p, long long mod) {
  long long ret = 1;
  while (p) {
    if (p & 1)
      ret = ret * x % mod;
    x = x * x % mod;
    p >>= 1;
  }
  return ret;
}


int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  f[0] = g[0] = 1;
  for (int i = 1; i < 1100000; i++) {
    f[i] = i * f[i-1] % MOD;
    g[i] = modpow(f[i], MOD-2, MOD);
  }
  
  int n;
  cin >> n;
  cout << homo(10, n) << endl;
  
  return 0;
}
0