結果
| 問題 | 
                            No.129 お年玉(2)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             mds_boy
                         | 
                    
| 提出日時 | 2015-01-17 00:00:54 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 417 bytes | 
| コンパイル時間 | 867 ms | 
| コンパイル使用メモリ | 55,476 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-06-22 13:02:26 | 
| 合計ジャッジ時間 | 1,901 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 5 WA * 41 | 
ソースコード
#include <iostream>
using namespace std;
typedef long long LL;
const LL b = 1000000000;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	LL n;
	int m;
	cin >> n >> m;
	
	int a = n / 1000 % m;
	
	if(a == 0)
		cout << 1 << endl;
	else{	
		int ans = 1;
		for(int i = m; i != a; --i){
			ans *= i;
			ans %= b;
		}
		
		for(int i = m - a; i != 1; --i){
			ans /= i;
		}
		cout << ans << endl;
	}
		
	return 0;
}
            
            
            
        
            
mds_boy