Skip to content

Commit 0c8c424

Browse files
committed
atcoder grand 31
1 parent 0e77d96 commit 0c8c424

File tree

6 files changed

+37
-0
lines changed

6 files changed

+37
-0
lines changed

atcoder/grand/31/A.cpp

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include <iostream>
2+
#include <string>
3+
#define MOD 1000000007
4+
5+
using namespace std;
6+
7+
long long ans;
8+
int cnt[30], n;
9+
string s;
10+
11+
void dfs(int here, long long ansHere)
12+
{
13+
if(here == 'z' - 'a' + 1)
14+
{
15+
ans = (ans + ansHere) % MOD;
16+
return;
17+
}
18+
19+
dfs(here + 1, ansHere);
20+
if(cnt[here] > 0)
21+
dfs(here + 1, (ansHere * cnt[here]) % MOD);
22+
23+
}
24+
25+
int main()
26+
{
27+
cin.tie(NULL);
28+
ios::sync_with_stdio(false);
29+
30+
cin >> n >> s;
31+
for(int i = 0; i < n; i++)
32+
cnt[s[i] - 'a']++;
33+
34+
dfs(0, 1);
35+
36+
cout << ans - 1 << '\n';
37+
}

atcoder/grand/31/B.cpp

Whitespace-only changes.

atcoder/grand/31/C.cpp

Whitespace-only changes.

atcoder/grand/31/D.cpp

Whitespace-only changes.

atcoder/grand/31/E.cpp

Whitespace-only changes.

atcoder/grand/31/F.cpp

Whitespace-only changes.

0 commit comments

Comments
 (0)