結果

問題 No.3011 あ、俺こいつの役やりたい!
ユーザー みうね
提出日時 2025-01-25 14:59:00
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 13,991 ms
コンパイル使用メモリ 378,264 KB
実行使用メモリ 25,984 KB
平均クエリ数 12.66
最終ジャッジ日時 2025-01-25 23:38:54
合計ジャッジ時間 15,472 ms
ジャッジサーバーID
(参考情報)
judge1 / judge12
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 44
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: denote infinite loops with `loop { ... }`
 --> src/main.rs:9:5
  |
9 |     while true {
  |     ^^^^^^^^^^ help: use `loop`
  |
  = note: `#[warn(while_true)]` on by default

ソースコード

diff #

use proconio::{input, source::line::LineSource};
use std::io::{stdin, stdout, BufReader, Write};

fn main() {
    let stdin = stdin();
    let mut source = LineSource::new(BufReader::new(stdin.lock()));

    let mut right = 1 << 30;
    while true {
        right = right / 2;

        println!("{}", right);
        stdout().flush().unwrap();

        input! {
            from &mut source,
            ok: usize,
        }

        if ok == 1 {
        	println!("{}", right);
        	break;
        }
    }
}
0