結果
| 問題 |
No.170 スワップ文字列(Easy)
|
| コンテスト | |
| ユーザー |
古寺いろは
|
| 提出日時 | 2015-03-22 23:36:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 5,000 ms |
| コード長 | 694 bytes |
| コンパイル時間 | 743 ms |
| コンパイル使用メモリ | 67,160 KB |
| 実行使用メモリ | 7,296 KB |
| 最終ジャッジ日時 | 2024-12-23 00:15:26 |
| 合計ジャッジ時間 | 1,385 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <iostream>
#include <string>
#include<map>
#define mod 57300000
using namespace std;
int dp[1001][1001];
void settingC(){
for (int i = 0; i < 1001; i++)
{
dp[i][0] = 1;
for (int j = 1; j <= i; j++)
{
dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];
dp[i][j] %= mod;
}
}
}
int main(int argc, char* argv[]) {
string S;
cin >> S;
map<char, int> m;
settingC();
for (int i = 0; i < S.size(); i++)
{
m[S[i]]++;
}
int remain = S.size();
int ans = 1;
map<char, int>::iterator it = m.begin();
while (it != m.end())
{
ans *= dp[remain][(*it).second];
ans %= mod;
remain -= (*it).second;
++it;
}
ans += mod - 1;
ans %= mod;
cout << ans << endl;
}
古寺いろは