結果
| 問題 | No.3002 多項式の割り算 〜easy〜 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-05 02:13:46 |
| 言語 | Rust (1.99.0 + proconio + num + itertools + ACL) |
| 結果 |
WJ
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,390 bytes |
| 記録 | |
| 最終ジャッジ日時 | 2026-06-27 09:15:13 |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
ソースコード
use std::{collections::VecDeque, io::Stdin, str::FromStr};
struct Scanner {
stdin: Stdin,
buf: VecDeque<String>,
}
impl Scanner {
fn new() -> Scanner {
Scanner {
stdin: std::io::stdin(),
buf: VecDeque::new(),
}
}
fn read(&mut self) -> String {
loop {
if let Some(x) = self.buf.pop_front() {
break x;
}
let mut s = String::new();
self.stdin.read_line(&mut s).unwrap();
s.trim()
.split_whitespace()
.for_each(|x| self.buf.push_back(x.to_string()));
}
}
fn string(&mut self) -> String {
self.read()
}
fn parse<T: FromStr>(&mut self) -> T {
self.read().parse().ok().unwrap()
}
fn u64(&mut self) -> u64 {
self.parse()
}
fn i64(&mut self) -> i64 {
self.parse()
}
fn chars(&mut self) -> Vec<char> {
self.string().chars().collect()
}
}
fn main() {
let mut scanner = Scanner::new();
let a = scanner.i64();
let b = scanner.i64();
let mut state = [0; 3];
state[2] = a;
for i in 0..b {
state[0] = state[1];
state[1] = state[2];
state[2] = 0;
state[2] -= state[0];
state[1] -= state[0];
state[0] = 0;
}
println!("{} {}", state[1], state[2]);
}