結果
| 問題 | No.171 スワップ文字列(Med) | 
| コンテスト | |
| ユーザー |  hogeover30 | 
| 提出日時 | 2015-03-23 02:19:53 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 9 ms / 1,000 ms | 
| コード長 | 689 bytes | 
| コンパイル時間 | 695 ms | 
| コンパイル使用メモリ | 73,016 KB | 
| 実行使用メモリ | 7,936 KB | 
| 最終ジャッジ日時 | 2024-06-29 00:21:43 | 
| 合計ジャッジ時間 | 1,324 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 10 | 
ソースコード
#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)%mod;
        cout<<res<<endl;
    }
}
            
            
            
        