結果

問題 No.2707 Bag of Words Encryption
ユーザー marble72marble72
提出日時 2024-03-31 14:02:24
言語 Rust
(1.77.0)
結果
TLE  
実行時間 -
コード長 540 bytes
コンパイル時間 695 ms
コンパイル使用メモリ 187,124 KB
実行使用メモリ 8,596 KB
最終ジャッジ日時 2024-03-31 14:02:36
合計ジャッジ時間 4,064 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable does not need to be mutable
 --> Main.rs:6:9
  |
6 |     let mut n:i32 = inpt_vec[0].parse().unwrap();
  |         ----^
  |         |
  |         help: remove this `mut`
  |
  = note: `#[warn(unused_mut)]` on by default

warning: 1 warning emitted

ソースコード

diff #

use std::vec;

fn main() {
    let inpt = getline();
    let inpt_vec:Vec<_>=inpt.trim().split(' ').collect();
    let mut n:i32 = inpt_vec[0].parse().unwrap();
    let s = getline();

    let mut ans = vec![0;26];
    for i in 0..(n as usize) {
        let num = s.chars().nth(i).unwrap() as i32 - 'A' as i32;
        ans[num as usize]+=1;
    }
    for i in ans {
        print!("{}",i);
    }
    println!();
}

fn getline() -> String {
    let mut _ret = String::new();
    std::io::stdin().read_line(&mut _ret).ok();
    return _ret;
}
0