結果
| 問題 |
No.148 試験監督(3)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-07 18:39:30 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,215 bytes |
| コンパイル時間 | 584 ms |
| コンパイル使用メモリ | 88,748 KB |
| 実行使用メモリ | 13,696 KB |
| 最終ジャッジ日時 | 2024-07-05 19:53:21 |
| 合計ジャッジ時間 | 5,163 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 11 |
ソースコード
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef pair<int, int> PI;
const double EPS=1e-9;
const ll mod = 1e9+7;
PI conv(const string &s) {
ll a = 0;
int over = 0;
REP(i, 0, s.size()) {
a *= 10;
a += s[i] - '0';
if (a >= mod) {
over = 1;
}
a %= mod;
}
return PI((int)a, over);
}
int main(void){
int t;
cin >> t;
REP(i, 0, t) {
string c, p;
cin >> c >> p;
PI cc = conv(c), pc = conv(p);
if (pc.second) {
cout << 0 << endl;
continue;
}
ll cq = cc.first, pq = pc.first;
ll sum = 1;
cq += mod - pq + 1;
cq %= mod;
REP(j, 0, pq) {
sum *= (cq - j + mod);
sum %= mod;
}
cout << sum << endl;
}
}