結果
| 問題 |
No.2707 Bag of Words Encryption
|
| ユーザー |
ARCANA
|
| 提出日時 | 2024-04-06 14:23:06 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,093 bytes |
| コンパイル時間 | 11,935 ms |
| コンパイル使用メモリ | 394,280 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-01 03:51:05 |
| 合計ジャッジ時間 | 12,881 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 |
コンパイルメッセージ
warning: unused import: `core::str::Chars`
--> src/main.rs:2:5
|
2 | use core::str::Chars;
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: struct `Graph` is never constructed
--> src/main.rs:6:8
|
6 | struct Graph {
| ^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: struct `WeightGraph` is never constructed
--> src/main.rs:10:8
|
10 | struct WeightGraph {
| ^^^^^^^^^^^
warning: struct `Point` is never constructed
--> src/main.rs:15:8
|
15 | struct Point {
| ^^^^^
warning: struct `PointGroup` is never constructed
--> src/main.rs:20:8
|
20 | struct PointGroup{
| ^^^^^^^^^^
warning: structure field `adjMatrixs` should have a snake case name
--> src/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
ソースコード
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();
}
ARCANA