結果

問題 No.3011 あ、俺こいつの役やりたい!
ユーザー NakLon131
提出日時 2025-03-20 22:40:33
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 2,029 bytes
コンパイル時間 12,621 ms
コンパイル使用メモリ 405,556 KB
実行使用メモリ 26,240 KB
平均クエリ数 12.45
最終ジャッジ日時 2025-03-20 22:41:45
合計ジャッジ時間 17,519 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    // let n = read_usize();
    
	let mut ans = 1000000000 as usize;
	loop {
		println!("{}", ans);
		let x = read_usize();
		if x != 0 {
			return;
		}
		ans /= 2;
	}
}

// ---------- start input macro ----------
#[allow(unused)]
use std::{
	io, io::stderr, io::stdin, io::BufRead, io::Write, str::FromStr,
	mem::swap,
	cmp::min, cmp::max,
	cmp::Reverse,
	collections::HashSet, collections::BTreeSet,
	collections::HashMap, collections::BTreeMap,
	collections::BinaryHeap,
	collections::VecDeque,
};

// usizeで受け取り
#[allow(unused)]
fn read_usize() -> usize {
    let mut input = String::new();
    io::stdout().flush().unwrap();  // 出力バッファをフラッシュ
    io::stdin().read_line(&mut input).unwrap();
    input.trim().parse().unwrap()
}

// 数値型を配列で受け取り
#[allow(unused)]
fn read_numbers_vec<T>(n: usize) -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: std::fmt::Debug,
{
    let mut input = String::new();
    io::stdout().flush().unwrap();
    io::stdin().read_line(&mut input).unwrap();
    input.trim()
        .split_whitespace()  // 空白区切りで分割
        .take(n)  // 指定された個数分だけ取り出す
        .map(|s| s.parse().unwrap())  // 各値をTに変換
        .collect()  // ベクターとして収集
}

// char型配列で受け取り
#[allow(unused)]
fn read_char_array() -> Vec<char> {
    let mut input = String::new();
    io::stdout().flush().unwrap();
    io::stdin().read_line(&mut input).unwrap();
    input.trim().chars().collect()
}

// 文字列型で受け取り
#[allow(unused)]
fn read_string() -> String {
    let mut input = String::new();
    io::stdout().flush().unwrap();
    io::stdin().read_line(&mut input).unwrap();
    input.trim().to_string()
}

// 配列のスペース区切り出力
#[allow(unused)]
fn vec_print<T: std::fmt::Display>(vec: &Vec<T>) {
	let sz = vec.len();
	for i in 0..sz-1 {
		print!("{} ", vec[i]);
	}
	println!("{}", vec[sz-1]);
}

// ---------- end input macro ----------
0