結果

問題 No.2707 Bag of Words Encryption
ユーザー marble72
提出日時 2024-03-31 14:02:24
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 530 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 13,478 ms
コンパイル使用メモリ 379,164 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-09-30 18:50:16
合計ジャッジ時間 20,505 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable does not need to be mutable
 --> src/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

ソースコード

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