結果

問題 No.129 お年玉(2)
ユーザー kkslucy1
提出日時 2018-03-21 02:57:18
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 307 bytes
コンパイル時間 1,320 ms
コンパイル使用メモリ 158,368 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-24 18:30:07
合計ジャッジ時間 2,569 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5 WA * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	ll n;
	int m, r;
	cin >> n >> m;
	r = n / 1000 % m;

	ll ans = 1;
	int mr = m - r;
	while (m >mr) {
		ans *= m--;
		while (r>0&&ans%r == 0) {
			ans /= r--;
		}
		ans %= 1000000000;
	}


	cout << ans << endl;



	return 0;
}
0