//! # Bundled libraries //! //! - `arithmetic_series 0.1.0 (git+https://github.com/ia7ck/rust-competitive-programming#b60dc67706797611e680510aa6492f6397a2e104)` licensed under **missing** as `crate::__cargo_equip::crates::arithmetic_series` //! - `input_i_scanner 0.1.0 (git+https://github.com/ia7ck/rust-competitive-programming#b60dc67706797611e680510aa6492f6397a2e104)` licensed under **missing** as `crate::__cargo_equip::crates::input_i_scanner` pub use __cargo_equip::prelude::*; use arithmetic_series::arithmetic_series; use input_i_scanner::InputIScanner; fn main() { let stdin = std::io::stdin(); let mut _i_i = InputIScanner::from(stdin.lock()); macro_rules! scan { (($($t: ty),+)) => { ($(scan!($t)),+) }; ($t: ty) => { _i_i.scan::<$t>() as $t }; (($($t: ty),+); $n: expr) => { std::iter::repeat_with(|| scan!(($($t),+))).take($n).collect::>() }; ($t: ty; $n: expr) => { std::iter::repeat_with(|| scan!($t)).take($n).collect::>() }; } let n = scan!(u64); // 1 + 2 + 3 + ... let ans = arithmetic_series(1, (n + 1) / 2, 1).unwrap(); println!("{}", ans); } // The following code was expanded by `cargo-equip`. #[rustfmt::skip] #[allow(unused)] mod __cargo_equip { pub(crate) mod crates { pub mod arithmetic_series {pub fn arithmetic_series(a:T,n:T,d:T)->Option{assert!(n.is_positive());let last=d.checked_mul(n.decrement())?.checked_add(a)?;a.checked_add(last)?.checked_mul(n)?.checked_div(T::two())}pub trait Int:Copy+Ord{fn is_positive(self)->bool;fn decrement(self)->Self;fn checked_add(self,rhs:Self)->Option;fn checked_mul(self,rhs:Self)->Option;fn checked_div(self,rhs:Self)->Option;fn two()->Self;}macro_rules!impl_int{($($t:ty),+)=>{$(impl Int for$t{fn is_positive(self)->bool{self>=1}fn decrement(self)->Self{self-1}fn checked_add(self,rhs:Self)->Option{self.checked_add(rhs)}fn checked_mul(self,rhs:Self)->Option{self.checked_mul(rhs)}fn checked_div(self,rhs:Self)->Option{self.checked_div(rhs)}fn two()->Self{2}})+};}impl_int!(i32,i64,u32,u64,usize);} pub mod input_i_scanner {use std::fmt;use std::io;use std::str;pub struct InputIScanner{r:R,l:String,i:usize,}implInputIScanner{pub fn new(reader:R)->Self{Self{r:reader,l:String::new(),i:0,}}pub fn scan(&mut self)->T where T:str::FromStr,::Err:fmt::Debug,{self.skip_blanks();assert!(self.i{self.i+=j;break;}None=>{let mut buf=String::new();let num_bytes=self.r.read_line(&mut buf).unwrap_or_else(|_|panic!("invalid UTF-8"));assert!(num_bytes>0,"reached EOF :(");self.l=buf.trim_end_matches('\n').trim_end_matches('\r').to_string();self.i=0;}}}}}impl<'a>From<&'a str>for InputIScanner<&'a[u8]>{fn from(s:&'a str)->Self{Self::new(s.as_bytes())}}impl<'a>From >for InputIScanner > >{fn from(stdin:io::StdinLock<'a>)->Self{Self::new(io::BufReader::new(stdin))}}} } pub(crate) mod macros { pub mod arithmetic_series {} pub mod input_i_scanner {} } pub(crate) mod prelude {pub use crate::__cargo_equip::crates::*;} mod preludes { pub mod arithmetic_series {} pub mod input_i_scanner {} } }