We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0e77d96 commit 0c8c424Copy full SHA for 0c8c424
atcoder/grand/31/A.cpp
@@ -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
atcoder/grand/31/C.cpp
atcoder/grand/31/D.cpp
atcoder/grand/31/E.cpp
atcoder/grand/31/F.cpp
0 commit comments