Created
May 31, 2021 09:22
-
-
Save sakapon/0a32004394bc6ef63f1f0f473b4ab9cd to your computer and use it in GitHub Desktop.
競プロ典型 90 問 / Q008
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
class Q008 | |
{ | |
const string AtCoder = "atcoder"; | |
const long M = 1000000007; | |
static void Main() | |
{ | |
var n = int.Parse(Console.ReadLine()); | |
var s = Console.ReadLine(); | |
var dp = new long[AtCoder.Length + 1]; | |
dp[0] = 1; | |
foreach (var c in s) | |
{ | |
var i = AtCoder.IndexOf(c); | |
if (i == -1) continue; | |
dp[i + 1] += dp[i]; | |
dp[i + 1] %= M; | |
} | |
Console.WriteLine(dp[^1]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://atcoder.jp/contests/typical90/submissions/23091974