結果
| 問題 |
No.171 スワップ文字列(Med)
|
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2022-12-25 20:37:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 1,000 ms |
| コード長 | 928 bytes |
| コンパイル時間 | 881 ms |
| コンパイル使用メモリ | 109,560 KB |
| 最終ジャッジ日時 | 2025-02-09 20:59:47 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
using namespace std;
vector<vector<long long>> comb;
void combinations(long long n, long long modc=573){
comb.resize(n+1);
for (long long i=0; i<=n; i++){
comb[i].resize(n+1);
comb[i][0] = 1;
}
for (long long i=1; i <= n; i++){
for (long long j=1; j <= i; j++){
comb[i][j] = (comb[i-1][j-1] + comb[i-1][j]) % modc;
}
}
}
int main(){
combinations(1000);
long long tot=0, ans=1, N;
string S;
cin >> S;
N = S.size();
vector<long long> cnt(26);
for (auto x : S) cnt[x-'A']++;
for (int i=0; i<26; i++){
ans *= comb[N-tot][cnt[i]];
ans %= 573;
tot += cnt[i];
}
cout << (ans+572) % 573 << endl;
return 0;
}
srjywrdnprkt