Submission #3443229
Source Code Expand
macro_rules! input {
(source = $s:expr, $($r:tt)*) => {
let mut iter = $s.split_whitespace();
let mut next = || { iter.next().unwrap() };
input_inner!{next, $($r)*}
};
($($r:tt)*) => {
let stdin = std::io::stdin();
let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
let mut next = move || -> String{
bytes
.by_ref()
.map(|r|r.unwrap() as char)
.skip_while(|c|c.is_whitespace())
.take_while(|c|!c.is_whitespace())
.collect()
};
input_inner!{next, $($r)*}
};
}
macro_rules! input_inner {
($next:expr) => {};
($next:expr, ) => {};
($next:expr, $var:ident : $t:tt $($r:tt)*) => {
let $var = read_value!($next, $t);
input_inner!{$next $($r)*}
};
}
macro_rules! read_value {
($next:expr, ( $($t:tt),* )) => {
( $(read_value!($next, $t)),* )
};
($next:expr, [ $t:tt ; $len:expr ]) => {
(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
};
($next:expr, chars) => {
read_value!($next, String).chars().collect::<Vec<char>>()
};
($next:expr, i321) => {
read_value!($next, i32) - 1
};
($next:expr, $t:ty) => {
$next().parse::<$t>().expect("Parse error")
};
}
//
// # Examples
//
// # integers
// input! { n: i32, m: i32, ... }
//
// # array
// input! { n: i32, v: [i32; n], }
//
// # matrix
// input! { n: i32, m: i32, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
// h: i32,
// w: i32,
// board: [chars; h],
// }
// https://practice.contest.atcoder.jp/tasks/practice_1
//fn main() {
// input!{
// a: i32, b: i32, c: i32,
// foo: chars,
// }
// let s: String = foo.into_iter().collect();
// println!("{} {}", a+b+c, s);
//}
fn main() {
input! { s: chars }
let mut s = s.clone();
s[3] = '8';
let s: String = s.into_iter().collect();
println!("{}",s);
}
Submission Info
Submission Time |
|
Task |
A - Already 2018 |
User |
rustman |
Language |
Rust (1.15.1) |
Score |
100 |
Code Size |
2174 Byte |
Status |
AC |
Exec Time |
2 ms |
Memory |
4352 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
100 / 100 |
Status |
|
|
Set Name |
Test Cases |
Sample |
a01, a02 |
All |
a01, a02, b03, b04, b05, b06, b07, b08 |
Case Name |
Status |
Exec Time |
Memory |
a01 |
AC |
2 ms |
4352 KB |
a02 |
AC |
2 ms |
4352 KB |
b03 |
AC |
2 ms |
4352 KB |
b04 |
AC |
2 ms |
4352 KB |
b05 |
AC |
2 ms |
4352 KB |
b06 |
AC |
2 ms |
4352 KB |
b07 |
AC |
2 ms |
4352 KB |
b08 |
AC |
2 ms |
4352 KB |