結果

問題 No.170 スワップ文字列(Easy)
ユーザー tonyu0
提出日時 2020-04-05 12:27:40
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 518 bytes
コンパイル時間 13,786 ms
コンパイル使用メモリ 405,452 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-03 08:06:55
合計ジャッジ時間 13,645 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let s: Vec<usize> = s
        .trim()
        .chars()
        .map(|c| (c as u8 - 'A' as u8) as usize)
        .collect();

    let mut ans = 1;
    let mut count: Vec<usize> = vec![0; 26];
    for i in 0..s.len() {
        ans *= i + 1;
        count[s[i]] += 1;
    }
    for i in 0..26 {
        for j in 0..count[i] {
            ans /= j + 1;
        }
    }
    println!("{}", ans - 1);
}
0