結果

問題 No.3084 Identify f(x)
ユーザー yuusaan
提出日時 2025-03-22 15:26:34
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 755 bytes
コンパイル時間 14,779 ms
コンパイル使用メモリ 381,844 KB
実行使用メモリ 25,856 KB
平均クエリ数 3.00
最終ジャッジ日時 2025-04-04 20:52:24
合計ジャッジ時間 15,200 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused imports: `Write` and `stdout`
 --> src/main.rs:1:22
  |
1 | use std::io::{stdin, stdout, BufReader, Write};
  |                      ^^^^^^             ^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

ソースコード

diff #

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

fn main() {
    let stdin = stdin();
    let mut source = LineSource::new(BufReader::new(stdin.lock())); // LineSourceで1行ずつ入力を読む設定
    
    let mut x = 0;
    println!("? {}", x);// 改行あり(通常は自動でflushされる)
    input! {
        from &mut source, // リアルタイム入力の指定
        f0: i32,         // ジャッジから対応するRを受け取り、f0に代入
    }
    
    x = 1;
    println!("? {}", x);
    input! {
    	from &mut source,
    	f1: i32,
    }
    
    //求めるa,bを計算し、出力
    let a = f1-f0;
    let b = f0;
    println!("! {} {}", a, b);
}
0