結果
問題 |
No.129 お年玉(2)
|
ユーザー |
![]() |
提出日時 | 2016-03-30 21:51:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 699 bytes |
コンパイル時間 | 624 ms |
コンパイル使用メモリ | 73,468 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-02 08:16:56 |
合計ジャッジ時間 | 8,106 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 WA * 1 RE * 41 |
ソースコード
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define ll long long #define INF (1 << 30) #define INFLL (1LL << 60) ll kai(ll num){ ll ans = num; for(int i = num - 1;i >= 1;i--){ ans %= 1000000000; ans *= i; } ans %= 1000000000; return ans; } ll mCn(ll m,ll n){ ll ans = kai(m) / (kai(m-n) * kai(n)); return ans ; } int main() { ll n,m,amari; cin >> n >> m; amari = n % (1000 * m); amari = amari / 1000 * 1000; amari /= 1000; if(amari == 0) cout << 1 << endl; else cout << mCn(m,amari) << endl; return 0; }