結果

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

ソースコード

diff #

//#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <queue>
#include <iostream>
#include <cstring>
#include <climits>
#define INF INT_MAX / 2
#define MOD 1000000007

using namespace std;

typedef pair<int,int> PII;
typedef pair<int,pair<int,int>> PIPII;
typedef long long ll;

int dx[] = {0,1,0,-1};
int dy[] = {1,0,-1,0};

ll combi(ll n,ll r){
    ll ret = 1;
    for(int i=n;i>n-r;i--){
        ret *= i;
        ret %= MOD;
    }
    for(int i=r;i>=1;i--){
        ret /= i;
    }
    return ret;
}

int main(void) {    
    ll n,m;
    cin >> n >> m;
    ll nn = n/1000;
    ll amari = n - nn/m *1000*m;
    amari /= 1000;
    //cout << m << " " << amari << endl;
    if(amari > m)swap(amari,m);
    cout << combi(m,amari) << endl;

    return 0;
}
0