結果
| 問題 |
No.129 お年玉(2)
|
| コンテスト | |
| ユーザー |
ふう
|
| 提出日時 | 2015-01-21 22:35:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 826 bytes |
| コンパイル時間 | 588 ms |
| コンパイル使用メモリ | 81,536 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-22 23:33:40 |
| 合計ジャッジ時間 | 1,931 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 2 WA * 44 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <map>
#include <list>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <iomanip>
#define INF 1050000000
using namespace std;
long long nCr(long long n, long long r){
long long P[100];
if(n > 33) {
cout << "error" << endl;
return (0);
}
memset(P, 0, sizeof(P));
P[0] = P[1] = 1;
for (int i = 2; i <= n; i++) {
for (int j = i; j > 0; j--) {
P[j] = (P[j] + P[j - 1]) % 1000000000;
}
}
return (P[r]);
}
int main(void)
{
long long int n, m;
long long int a;
long long int ans = 1;
cin >> n >> m;
a = n - (((n / m) / 1000) * 1000) * m;
a /= 1000;
cout << nCr(m, a) << endl;
return (0);
}
ふう