結果

問題 No.170 スワップ文字列(Easy)
ユーザー aaaaaaiu
提出日時 2019-08-08 01:47:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 348 bytes
コンパイル時間 2,121 ms
コンパイル使用メモリ 194,216 KB
最終ジャッジ日時 2025-01-07 11:00:15
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int f(int n) {
    int ret=1;
    for (int i=2;i<=n;i++) ret*=i;
    return ret;
}

int main() {
    string s;
    cin>>s;
    int n=s.size();
    int cnt[256]{};
    for (char c:s) cnt[c]++;
    int ans=f(n);
    for (int i:cnt) ans/=f(i);
    cout<<ans-1<<endl;
    return 0;
}
0