結果

問題 No.305 鍵(2)
ユーザー titiatitia
提出日時 2022-11-08 03:32:10
言語 Rust
(1.77.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 1,043 bytes
コンパイル時間 1,368 ms
コンパイル使用メモリ 151,088 KB
実行使用メモリ 24,312 KB
平均クエリ数 86.69
最終ジャッジ日時 2023-09-24 03:08:10
合計ジャッジ時間 2,696 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
23,196 KB
testcase_01 AC 28 ms
23,628 KB
testcase_02 AC 27 ms
23,220 KB
testcase_03 AC 28 ms
24,312 KB
testcase_04 AC 28 ms
23,340 KB
testcase_05 AC 27 ms
23,544 KB
testcase_06 AC 24 ms
23,400 KB
testcase_07 AC 28 ms
23,412 KB
testcase_08 AC 26 ms
24,012 KB
testcase_09 AC 27 ms
23,616 KB
testcase_10 AC 27 ms
23,352 KB
testcase_11 AC 27 ms
23,412 KB
testcase_12 AC 28 ms
23,844 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `y`
  --> Main.rs:24:21
   |
24 |             let (x, y): (i32, String) = {
   |                     ^ help: if this is intentional, prefix it with an underscore: `_y`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

ソースコード

diff #

fn main() {


    let mut ans=vec![0;10];
    let mut flag=0;

    for i in 0..10{

        let mut maxj=-1;
        let mut indj=-1;

        for j in 0..10{

            ans[i]=j;

            println!(
                "{}",
                ans.iter()
                    .map(std::string::ToString::to_string)
                    .collect::<Vec<_>>()
                    .join("")
            );

            let (x, y): (i32, String) = {
                let mut line: String = String::new();
                std::io::stdin().read_line(&mut line).unwrap();
                let mut iter = line.split_whitespace();
                (
                    iter.next().unwrap().parse().unwrap(),
                    iter.next().unwrap().parse().unwrap(),
                )
            };

            if x==10{
                flag=1;
                break;
            }

            if x>maxj{
                maxj=x;
                indj=j;
            }
        }
        if flag==1{
            break;
        }
        ans[i]=indj;
    }
}
0