結果
問題 | No.726 Tree Game |
ユーザー |
![]() |
提出日時 | 2018-08-24 22:05:21 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,810 bytes |
コンパイル時間 | 28,052 ms |
コンパイル使用メモリ | 383,200 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 07:28:22 |
合計ジャッジ時間 | 17,137 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 WA * 2 |
ソースコード
#[allow(unused_imports)] use std::cmp::{min,max}; #[allow(unused_imports)] use std::collections::BTreeMap; #[allow(unused_imports)] use std::ops::*; #[allow(unused_imports)] use std::collections::BinaryHeap; #[allow(unused_macros)] macro_rules! tf { ($c:expr, $t:expr, $f:expr) => {{ if $c { $t } else { $f } }}; } fn is_prime(x: i64) -> bool { for i in 2.. { if i * i > x { break; } if x % i == 0 { return false; } } true } fn main() { let (y,x) = { let xs = read_vec_i64(); (xs[0], xs[1]) }; let y2 = { let mut res = y; for i in y+1.. { if is_prime(i) { res = i; break; } } res }; let x2 = { let mut res = x; for i in x+1.. { if is_prime(i) { res = i; break; } } res }; println!("{}", tf!(((y2-y)+(x2-x)) % 2 != 0, "First", "Second")); } #[allow(dead_code)] fn read_line() -> String { let mut ret = String::new(); std::io::stdin().read_line(&mut ret).ok(); ret.pop(); return ret; } #[allow(dead_code)] fn read_i64() -> i64 { let ss = read_line(); return ss.parse::<i64>().unwrap(); } #[allow(dead_code)] fn read_vec_i64() -> Vec<i64> { let mut res = vec![]; let ss = read_line(); for ts in ss.split_whitespace() { let x = ts.parse::<i64>().unwrap(); res.push(x); } return res; } use std::fmt::Display; #[allow(dead_code)] fn write_vec<T: Display>(xs: &Vec<T>) { if xs.len() == 0 { println!(""); return; } print!("{}", xs[0]); for i in 1..xs.len() { print!(" {}", xs[i]); } println!(""); }