Submission #24491662
Source Code Expand
#include<bits/stdc++.h>
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)
using namespace std;
bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }
const string YES = "";
const string NO = "";
typedef long long ll;
typedef pair<int,int> ii;
const ll mod = 1000000007LL;
#define MAX 200010
ll dp[MAX][10];
void solve() {
}
string t = "chokudai";
int main() {
string s;
cin >> s;
int n = s.size();
dp[0][0] = 1;
rep(i,n) {
rep(j,8) {
if( dp[i][j] == 0 ) continue;
if( s[i] == t[j] ) {
( dp[i+1][j+1] += dp[i][j] ) %= mod;
}
( dp[i+1][j] += dp[i][j] ) %= mod;
}
}
ll ans = 0;
rep(i,n+1) {
( ans += dp[i][(int)t.size()] ) %= mod;
}
cout << ans << endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - chokudai |
| User | Eldora |
| Language | C++ (GCC 9.2.1) |
| Score | 300 |
| Code Size | 1023 Byte |
| Status | AC |
| Exec Time | 21 ms |
| Memory | 11560 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt, example2.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, example0.txt, example1.txt, example2.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 5 ms | 3700 KiB |
| 001.txt | AC | 2 ms | 3596 KiB |
| 002.txt | AC | 2 ms | 3652 KiB |
| 003.txt | AC | 2 ms | 3780 KiB |
| 004.txt | AC | 4 ms | 3728 KiB |
| 005.txt | AC | 2 ms | 3704 KiB |
| 006.txt | AC | 2 ms | 3788 KiB |
| 007.txt | AC | 2 ms | 3740 KiB |
| 008.txt | AC | 15 ms | 11536 KiB |
| 009.txt | AC | 18 ms | 11480 KiB |
| 010.txt | AC | 15 ms | 11508 KiB |
| 011.txt | AC | 21 ms | 11432 KiB |
| 012.txt | AC | 15 ms | 11376 KiB |
| 013.txt | AC | 17 ms | 11560 KiB |
| 014.txt | AC | 15 ms | 11484 KiB |
| 015.txt | AC | 14 ms | 11532 KiB |
| example0.txt | AC | 2 ms | 3616 KiB |
| example1.txt | AC | 2 ms | 3588 KiB |
| example2.txt | AC | 2 ms | 3616 KiB |