結果
| 問題 |
No.524 コインゲーム
|
| ユーザー |
|
| 提出日時 | 2017-10-13 17:55:51 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,371 bytes |
| コンパイル時間 | 13,238 ms |
| コンパイル使用メモリ | 378,580 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 11:27:05 |
| 合計ジャッジ時間 | 14,425 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 WA * 8 |
ソースコード
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
mod util {
use std::io::stdin;
use std::str::FromStr;
use std::fmt::Debug;
#[allow(dead_code)]
pub fn line() -> String {
let mut line: String = String::new();
stdin().read_line(&mut line).unwrap();
line.trim().to_string()
}
#[allow(dead_code)]
pub fn get<T: FromStr>() -> T
where
<T as FromStr>::Err: Debug,
{
let mut line: String = String::new();
stdin().read_line(&mut line).unwrap();
line.trim().parse().unwrap()
}
#[allow(dead_code)]
pub fn gets<T: FromStr>() -> Vec<T>
where
<T as FromStr>::Err: Debug,
{
let mut line: String = String::new();
stdin().read_line(&mut line).unwrap();
line.split_whitespace()
.map(|t| t.parse().unwrap())
.collect()
}
#[allow(dead_code)]
pub fn get2<T: FromStr, U: FromStr>() -> (T, U)
where
<T as FromStr>::Err: Debug,
<U as FromStr>::Err: Debug,
{
let mut line: String = String::new();
stdin().read_line(&mut line).unwrap();
let mut iter = line.split_whitespace();
(
iter.next().unwrap().parse().unwrap(),
iter.next().unwrap().parse().unwrap(),
)
}
#[allow(dead_code)]
pub fn get3<S: FromStr, T: FromStr, U: FromStr>() -> (S, T, U)
where
<S as FromStr>::Err: Debug,
<T as FromStr>::Err: Debug,
<U as FromStr>::Err: Debug,
{
let mut line: String = String::new();
stdin().read_line(&mut line).unwrap();
let mut iter = line.split_whitespace();
(
iter.next().unwrap().parse().unwrap(),
iter.next().unwrap().parse().unwrap(),
iter.next().unwrap().parse().unwrap(),
)
}
}
#[allow(unused_macros)]
macro_rules! debug {
($x: expr) => {
println!("{}: {:?}", stringify!($x), $x)
}
}
fn main() {
let n: u64 = util::get();
if (1..33).all(|i| {
let c = 2u64.pow(i as u32);
let rest = (n + 1) % c;
if rest <= c / 2 {
true
} else {
(rest - c / 2) % 2 == 0
}
})
{
println!("X");
} else {
println!("O");
}
}