結果
| 問題 |
No.171 スワップ文字列(Med)
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-03-23 02:18:48 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 685 bytes |
| コンパイル時間 | 672 ms |
| コンパイル使用メモリ | 72,772 KB |
| 実行使用メモリ | 8,064 KB |
| 最終ジャッジ日時 | 2024-06-29 00:21:41 |
| 合計ジャッジ時間 | 1,375 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 3 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
const int mod=573;
int main()
{
map<int, int> f[1010];
for(int i=1;i<1010;++i) {
f[i]=f[i-1];
int x=i;
for(int j=2;j*j<=x;++j) while (x%j==0) { f[i][j]++; x/=j; }
if (x>1) f[i][x]++;
}
string s;
while (cin>>s) {
int a[256]={};
for(char c: s) a[c]++;
auto r=f[s.size()];
for(int v: a) if (v)
for(auto& t: f[v]) r[t.first]-=t.second;
int res=1;
for(auto& v: r)
for(int i=0;i<v.second;++i) res=res*v.first%mod;
res=(res-1)%mod;
cout<<res<<endl;
}
}
hogeover30