結果
| 問題 | 
                            No.1943 消えたAGCT(1)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-06-27 10:47:44 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 7 ms / 2,000 ms | 
| コード長 | 485 bytes | 
| コンパイル時間 | 12,694 ms | 
| コンパイル使用メモリ | 383,108 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-18 20:55:49 | 
| 合計ジャッジ時間 | 14,452 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 27 | 
コンパイルメッセージ
warning: unused `Result` that must be used --> src/main.rs:5:5 | 5 | io::stdin().read_line(&mut nn); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled = note: `#[warn(unused_must_use)]` on by default help: use `let _ = ...` to ignore the resulting value | 5 | let _ = io::stdin().read_line(&mut nn); | +++++++ warning: unused `Result` that must be used --> src/main.rs:11:5 | 11 | io::stdin().read_line(&mut ss); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled help: use `let _ = ...` to ignore the resulting value | 11 | let _ = io::stdin().read_line(&mut ss); | +++++++
ソースコード
use std::io;
fn main() {
    let mut nn = String::new();
    io::stdin().read_line(&mut nn);
    let n = match nn.trim().parse() {
        Ok(num) => num,
        Err(_) => 0
    };
    let mut ss = String::new();
    io::stdin().read_line(&mut ss);
    let s: Vec<char> = ss.chars().collect();
    let mut ans = 0;
    for i in 0..n {
        let c = s[i];
        if c == 'A' || c == 'G' || c == 'C' || c == 'T' {
            ans = i + 1;
        }
    }
    println!("{}", ans);
}