結果

問題 No.171 スワップ文字列(Med)
ユーザー hogeover30hogeover30
提出日時 2015-03-23 02:19:53
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 10 ms / 1,000 ms
コード長 689 bytes
コンパイル時間 608 ms
コンパイル使用メモリ 75,292 KB
実行使用メモリ 7,944 KB
最終ジャッジ日時 2023-09-11 09:43:28
合計ジャッジ時間 1,490 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
7,828 KB
testcase_01 AC 10 ms
7,888 KB
testcase_02 AC 10 ms
7,944 KB
testcase_03 AC 10 ms
7,804 KB
testcase_04 AC 9 ms
7,772 KB
testcase_05 AC 10 ms
7,892 KB
testcase_06 AC 9 ms
7,840 KB
testcase_07 AC 10 ms
7,912 KB
testcase_08 AC 10 ms
7,816 KB
testcase_09 AC 10 ms
7,816 KB
testcase_10 AC 10 ms
7,840 KB
testcase_11 AC 10 ms
7,768 KB
testcase_12 AC 10 ms
7,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
    }
}
0