結果

問題 No.129 お年玉(2)
ユーザー ふう
提出日時 2015-01-16 23:38:01
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 638 bytes
コンパイル時間 681 ms
コンパイル使用メモリ 81,312 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-22 12:18:51
合計ジャッジ時間 2,310 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 WA * 42
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;


int main(void)
{
	long long n, m;
	long long a;
	long long ans = 1;

	cin >> n >> m;
	
	

	a = n - (((n / m) / 1000) * 1000) * m;
	a /= 1000;

	for (int i = 0; i < a; i++) {
		ans *= m - i;
		ans %= 1000000000;
	}
	for (int i = 0; i < a; i++) {
		ans /= a - i;
	}

	cout << ans % 1000000000 << endl;

	return (0);
}
0