結果
問題 | No.171 スワップ文字列(Med) |
ユーザー | yosupot |
提出日時 | 2015-03-22 23:30:33 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 12 ms / 1,000 ms |
コード長 | 768 bytes |
コンパイル時間 | 485 ms |
コンパイル使用メモリ | 68,768 KB |
実行使用メモリ | 17,992 KB |
最終ジャッジ日時 | 2023-09-11 09:32:22 |
合計ジャッジ時間 | 1,385 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 11 ms
17,900 KB |
testcase_01 | AC | 11 ms
17,776 KB |
testcase_02 | AC | 12 ms
17,724 KB |
testcase_03 | AC | 11 ms
17,784 KB |
testcase_04 | AC | 11 ms
17,772 KB |
testcase_05 | AC | 11 ms
17,720 KB |
testcase_06 | AC | 12 ms
17,736 KB |
testcase_07 | AC | 12 ms
17,992 KB |
testcase_08 | AC | 11 ms
17,808 KB |
testcase_09 | AC | 12 ms
17,808 KB |
testcase_10 | AC | 11 ms
17,716 KB |
testcase_11 | AC | 11 ms
17,760 KB |
testcase_12 | AC | 12 ms
17,984 KB |
ソースコード
#include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <map> #include <queue> #include <set> #include <cassert> #include <cstdio> using namespace std; typedef long long ll; int comb[1919][1919]; void init() { comb[0][0] = 1; for (int i = 1; i < 1919; i++) { comb[i][0] = 1; for (int j = 1; j < 1919; j++) { comb[i][j] = (comb[i-1][j] + comb[i-1][j-1]) % 573; } } } int d[26]; int main() { init(); string s; cin >> s; int n = (int)s.size(); for (char c: s) { d[c-'A']++; } ll res = 1; for (int i = 0; i < 26; i++) { res *= comb[n][d[i]]; n -= d[i]; res %= 573; } cout << (res + 572) % 573 << endl; return 0; }