結果
問題 |
No.8048 Order and Harmony
|
ユーザー |
|
提出日時 | 2019-04-01 23:59:55 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,159 bytes |
コンパイル時間 | 685 ms |
コンパイル使用メモリ | 119,296 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-30 13:58:24 |
合計ジャッジ時間 | 42,250 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
other | AC * 26 WA * 25 TLE * 10 |
ソースコード
//#include "bits/stdc++.h" #include<iostream> using namespace std; #define mod 1000000007 #define dom 998244353 #define all(c) begin(c),end(c) #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--) template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <typename T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } #define long long long #define List vector #define var auto #define Count size() #define Length size() int dd[] = { 0, 1, 0, -1, 0 }; //→↓←↑ long powmod(long a, long b, long p) { if (b == 0) return 1; if (b % 2 == 0) { long d = powmod(a, b / 2, p); return d * d % p; } else { return a * powmod(a, b - 1, p) % p; } } void solve() { int K; cin >> K; if (K % 2 == 1) { cout << 0 << endl; return; } K >>= 1; long bunshi = 2; long bunbo = 1; for (int i = 0; i < K; i++) { bunshi = bunshi * (i + K) % mod; bunbo = bunbo * i % mod; } cout << (bunshi * powmod(bunbo, mod - 2, mod) % mod) << endl; } int main() { cin.tie(0); ios::sync_with_stdio(false); solve(); return 0; }