1
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?

初心者プログラマーAtCoderに挑んだ軌跡-ABC419-A-

Posted at

ABC419-A

問題の内容

文字列一致
与えられた文字列が事前条件の文字列に一致していれば特定の単語を返す。

言語

Rust

解法

matchを使って分岐

課題

  • matchの書き方

学んだこと

  • Stringと&strの違い
    Stringは文字列そのもののデータで、&strは文字列へのポインタのデータ

提出内容

use proconio::input;

fn main() {
  input! {
    s: String,
  }
  match s.as_str() {
    "red" => println!("SSS"),
    "blue" => println!("FFF"),
    "green" => println!("MMM"),
    _ => println!("Unknown"),
  }
}

成績

  • 225Byte
  • AC
  • 1ms
  • 2028KiB
1
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
1
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?