結果
問題 |
No.171 スワップ文字列(Med)
|
ユーザー |
![]() |
提出日時 | 2017-05-17 09:18:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 652 bytes |
コンパイル時間 | 1,170 ms |
コンパイル使用メモリ | 159,272 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-17 12:26:25 |
合計ジャッジ時間 | 2,510 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 WA * 4 RE * 4 |
ソースコード
#include"bits/stdc++.h" #include<fstream> #include<random> //#include<bits/stdc++.h> using namespace std; #define print(x) cout<<x<<endl; #define rep(i,a,b) for(int i=a;i<b;i++) typedef long long ll; const ll mod = 573; #define pi 3.141592 string s; ll ex(int n) { if (n == 1)return 1; return n*ex(n - 1)%mod; } int main() { cin >> s; ll count[26] = {}; int n = s.size(); rep(i, 0, n) { rep(j, 0, 26) { if (j == s[i] - 'A') { count[j]++; } } } ll ch = ex(n)%mod; rep(i, 0, 26) { if(count[i]>1)ch /= ex(count[i])%mod; } if (ch%mod == 0) { print(0); } else print(ch%mod - 1); //rep(i, 0, 26)print(count[i]); return 0; }