結果

問題 No.741 AscNumber(Easy)
ユーザー kk
提出日時 2020-09-24 00:46:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 723 bytes
コンパイル時間 1,996 ms
コンパイル使用メモリ 198,232 KB
実行使用メモリ 19,236 KB
最終ジャッジ日時 2023-09-10 13:15:15
合計ジャッジ時間 14,394 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 173 ms
19,024 KB
testcase_01 AC 173 ms
19,164 KB
testcase_02 AC 173 ms
18,972 KB
testcase_03 AC 174 ms
18,980 KB
testcase_04 AC 172 ms
19,036 KB
testcase_05 AC 175 ms
18,960 KB
testcase_06 AC 173 ms
18,976 KB
testcase_07 AC 174 ms
19,112 KB
testcase_08 AC 174 ms
18,976 KB
testcase_09 AC 173 ms
19,236 KB
testcase_10 AC 173 ms
19,236 KB
testcase_11 AC 173 ms
18,976 KB
testcase_12 AC 174 ms
18,972 KB
testcase_13 AC 173 ms
19,036 KB
testcase_14 AC 173 ms
18,984 KB
testcase_15 AC 173 ms
19,024 KB
testcase_16 AC 174 ms
18,968 KB
testcase_17 AC 174 ms
19,108 KB
testcase_18 AC 173 ms
19,108 KB
testcase_19 AC 174 ms
18,976 KB
testcase_20 AC 173 ms
18,968 KB
testcase_21 AC 173 ms
18,960 KB
testcase_22 AC 172 ms
19,220 KB
testcase_23 AC 173 ms
18,972 KB
testcase_24 AC 173 ms
19,180 KB
testcase_25 AC 174 ms
18,980 KB
testcase_26 AC 173 ms
19,172 KB
testcase_27 AC 172 ms
19,008 KB
testcase_28 AC 173 ms
19,168 KB
testcase_29 AC 173 ms
19,012 KB
testcase_30 AC 173 ms
19,100 KB
testcase_31 AC 174 ms
19,036 KB
testcase_32 AC 173 ms
19,044 KB
testcase_33 AC 173 ms
18,964 KB
testcase_34 AC 173 ms
18,972 KB
testcase_35 AC 174 ms
19,176 KB
testcase_36 AC 172 ms
19,040 KB
testcase_37 AC 173 ms
19,008 KB
testcase_38 AC 173 ms
18,964 KB
testcase_39 AC 173 ms
19,176 KB
testcase_40 AC 174 ms
18,964 KB
testcase_41 AC 173 ms
18,968 KB
testcase_42 AC 173 ms
18,968 KB
testcase_43 AC 173 ms
18,980 KB
testcase_44 AC 173 ms
19,220 KB
testcase_45 AC 174 ms
19,044 KB
testcase_46 AC 174 ms
18,972 KB
testcase_47 AC 174 ms
19,044 KB
testcase_48 AC 173 ms
18,968 KB
testcase_49 AC 173 ms
19,112 KB
testcase_50 AC 174 ms
19,180 KB
testcase_51 AC 175 ms
18,964 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 173 ms
19,160 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[1000000+1];
long long g[1000000+1];

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

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 <= 1000000; i++) {
    f[i] = i * f[i-1] % MOD;
    g[i] = modpow(f[i], MOD-2, MOD);
  }
  
  int n;
  cin >> n;
  cout << comb(10+n-1, n) << endl;
  
  return 0;
}
0