QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#449254#7018. Insertion SortHjccCompile Error//C++14762b2024-06-20 20:41:302024-06-20 20:41:31

Judging History

你现在查看的是最新测评结果

  • [2024-06-20 20:41:31]
  • 评测
  • [2024-06-20 20:41:30]
  • 提交

answer

# include <bits/stdc++.h>
# define ll long long

using namespace std;

const int N = 2e5 + 5;
ll fac[N], ifac[N];
ll mod = 1e9 + 7;

ll qp(ll x, int y = mod - 2) {
  ll res = 1;
  for (; y; y >>= 1, x = x * x % mod) {
    if (y & 1) {
      res = res * x % mod;
    }
  }
  return res;
}

int main() {
# ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
# endif
  init();
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int T; cin >> T;
  for (int i = 1; i <= T; i++) {
    int n, k;
    cin >> n >> k >> mod;k = min(n, k);
    ll ans = (k * (n - k) + (n - k) * (n - k - 1) + (n - k) - (n - 1 - k)) % mod;
    for (int i = 1; i <= k; i++) {ans = ans * i % mod;}
    cout << "Case #" << i << ": " << ans << '\n';
  }
}

Details

answer.code: In function ‘int main()’:
answer.code:24:3: error: ‘init’ was not declared in this scope; did you mean ‘int’?
   24 |   init();
      |   ^~~~
      |   int