# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
111134 | heon | Mate (COCI18_mate) | C++17 | 2048 ms | 1776 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
using namespace std;
#define int long long
const int MOD = 1000000007;
string s;
int q,qnum;
string qs;
int povrh(int a,int b){
int rt = 1;
int lt = 1;
for(int i = b; i > 0; i--){
rt *= a;
rt %= MOD;
lt *= i;
lt %= MOD;
a--;
}
int sol = rt/lt;
sol %= MOD;
return sol;
}
signed main(){
cin >> s >> q;
for(int i = 0; i < q; i++){
cin >> qnum >> qs;
int sol = 0;
for(int j = 0; j < s.size()-1; j++){
if(s[j] != qs[0]) continue;
for(int k = j+1; k < s.size(); k++){
if(s[k] != qs[1]) continue;
if(j >= qnum-2) sol += povrh(j,qnum-2);
}
}
sol %= MOD;
cout << sol << endl;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |