結果
問題 |
No.171 スワップ文字列(Med)
|
ユーザー |
![]() |
提出日時 | 2015-03-23 02:17:19 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 683 bytes |
コンパイル時間 | 665 ms |
コンパイル使用メモリ | 72,740 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 00:21:40 |
合計ジャッジ時間 | 2,086 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 1 RE * 4 |
ソースコード
#include <iostream> #include <algorithm> #include <string> #include <map> using namespace std; const int mod=573; int main() { map<int, int> f[600]; for(int i=1;i<600;++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; } }