0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

paiza.ioでrust その15

Last updated at Posted at 2024-11-17

概要

paiza.ioでrustやってみた。
練習問題やってみた。

練習問題

AtCoderをHashSetで解け。

方針

  • proconioは、使わない。

参考にしたページ

サンプルコード

ABC085B

use std::io;
use std::collections::HashSet;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).expect("Failed read line");
    let n:usize = input.trim().parse().unwrap();
    let mut list:Vec<usize> = Vec::new();
    for _ in 0..n
    {
        input.clear();
        io::stdin().read_line(&mut input).expect("Failed read line");
        let n:usize = input.trim().parse().unwrap();
        list.push(n);
    }
    let res:HashSet<usize> = list.into_iter().collect();
    println!("{}", res.len());
}

実行結果

3

成果物

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?