結果
問題 | No.129 お年玉(2) |
ユーザー |
![]() |
提出日時 | 2018-05-23 16:48:51 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 793 bytes |
コンパイル時間 | 562 ms |
コンパイル使用メモリ | 74,836 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 16:18:07 |
合計ジャッジ時間 | 2,440 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 41 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <numeric> #include <map> #include <set> #include <complex> using namespace std; #define REP(i,n) for(int i=0;i<(n);++i) #define REPS(i,s,t) for(int i=(s);i<(t);++i) #define INF 2000000007 #define MOD 1000000000 #define MAX 100005 typedef unsigned int uint; typedef unsigned long long int ull; typedef long long int ll; //int dp[MAX]; int nCr(int n,int r){ ull ans=1; r = min(r,n-r); vector<int> t(r); REP(i,r)t[i] = n-i; REPS(i,2,r+1){ REP(j,r){ if(t[j]%i==0){ t[j] /= i; break; } } } REP(i,r) ans = (ans * t[i])%(MOD); return (int)ans; } int main(){ ull N;cin>>N; int M;cin>>M; N /= 1000; int R = N%M; // M C R cout <<nCr(M,R) << endl; return 0; }