結果

問題 No.2707 Bag of Words Encryption
ユーザー ARCANAARCANA
提出日時 2024-04-06 14:23:06
言語 Rust
(1.77.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,093 bytes
コンパイル時間 1,019 ms
コンパイル使用メモリ 182,532 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-06 14:23:09
合計ジャッジ時間 2,361 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 1 ms
6,676 KB
testcase_08 AC 1 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 1 ms
6,676 KB
testcase_12 AC 1 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
testcase_14 AC 1 ms
6,676 KB
testcase_15 AC 1 ms
6,676 KB
testcase_16 AC 1 ms
6,676 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused import: `core::str::Chars`
 --> Main.rs:2:5
  |
2 | use core::str::Chars;
  |     ^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: struct `Graph` is never constructed
 --> Main.rs:6:8
  |
6 | struct Graph {
  |        ^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: struct `WeightGraph` is never constructed
  --> Main.rs:10:8
   |
10 | struct WeightGraph {
   |        ^^^^^^^^^^^

warning: struct `Point` is never constructed
  --> Main.rs:15:8
   |
15 | struct Point {
   |        ^^^^^

warning: struct `PointGroup` is never constructed
  --> Main.rs:20:8
   |
20 | struct PointGroup{
   |        ^^^^^^^^^^

warning: structure field `adjMatrixs` should have a snake case name
 --> Main.rs:8:5
  |
8 |     adjMatrixs: Vec<Vec<i32>>,
  |     ^^^^^^^^^^ help: convert the identifier to snake case: `adj_matrixs`
  |
  = note: `#[warn(non_snake_case)]` on by default

warning: 6 warnings emitted

ソースコード

diff #

use std::io;
use core::str::Chars;


// graph
struct Graph {
    node: i32,
    adjMatrixs: Vec<Vec<i32>>,
}
struct WeightGraph {
    node: i32,
    weight: Vec<Vec<i32>>,
}
// points
struct Point {
    x: i32,
    y: i32,
}

struct PointGroup{
    n: i32,
    point:Point,
}


fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
            assert!(_it.next().is_none());
        }
    };
}

fn solve(){
    from_line!(n: usize);
    let s = read_line();
    let mut list = vec![0;26];
    let ch:Vec<char> = s.chars().collect();
    for i in 0..n{
        let j = (ch[i] as i32) - ('A' as i32);
   //     println!("{}",j);
        list[j as usize] += 1;
    }
    //println!("{:?}",list);
    for a in &list{
        print!("{}",*a);
    }
    println!();
}
fn main() {
    solve();
}
0