結果
問題 | No.1432 Not Xor |
ユーザー | kichi2004_ |
提出日時 | 2021-03-19 21:47:40 |
言語 | Rust (1.77.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 1,569 bytes |
コンパイル時間 | 2,465 ms |
コンパイル使用メモリ | 151,096 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-12 01:44:53 |
合計ジャッジ時間 | 1,678 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 1 ms
4,376 KB |
testcase_06 | AC | 1 ms
4,380 KB |
testcase_07 | AC | 1 ms
4,376 KB |
コンパイルメッセージ
warning: unused import: `std::cmp::Ordering` --> Main.rs:4:5 | 4 | use std::cmp::Ordering; | ^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused import: `std::iter::FromIterator` --> Main.rs:5:5 | 5 | use std::iter::FromIterator; | ^^^^^^^^^^^^^^^^^^^^^^^ warning: 2 warnings emitted
ソースコード
use std::str::FromStr; use std::io::{BufRead, stdin, Stdin}; use std::collections::{VecDeque}; use std::cmp::Ordering; use std::iter::FromIterator; struct Scanner { sep: char, inputs: VecDeque<String>, cin: Stdin, } #[allow(unused)] impl Scanner { pub fn new(ch: char) -> Scanner { Scanner { sep: ch, inputs: VecDeque::new(), cin: stdin(), } } pub fn read<T: FromStr>(&mut self) -> T { let mut tries = 0; while bool::from(self.inputs.is_empty()) { if tries == 3 { panic!("3 Blank lines found."); } let cin_base = &mut self.cin; let cin = &mut cin_base.lock(); let mut str: String = String::new(); cin.read_line(&mut str).unwrap(); for s in str.trim_end().split(self.sep) { &self.inputs.push_back(String::from(s)); } tries += 1; } let s: String = String::from(&self.inputs.pop_front().unwrap()); s.parse::<T>().ok() .expect("Failed to parse token.") } pub fn read_i32(&mut self) -> i32 { self.read() } pub fn read_i64(&mut self) -> i32 { self.read() } pub fn read_usize(&mut self) -> usize { self.read() } pub fn read_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.read()).collect::<Vec<_>>() } } fn main() { let mut sc = Scanner::new(' '); let a = sc.read_i32(); let b = sc.read_i32(); println!("{}", (a | b) + (a & b)); }