-
Notifications
You must be signed in to change notification settings - Fork 2
/
fox_and_snake_510A.rs
43 lines (38 loc) · 942 Bytes
/
fox_and_snake_510A.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// https://codeforces.com/problemset/problem/510/A
// implementation
use std::io;
fn main() {
let mut line = String::new();
io::stdin()
.read_line(&mut line)
.unwrap();
let words: Vec<i64> =
line
.split_whitespace()
.map(|x| x.parse().unwrap())
.collect();
let mut n = words[0];
let m = words[1];
let mut direction = true;
while n > 0 {
if n%2 == 1 {
for _ in 0..m {
print!("#");
} println!();
} else {
if direction {
for _ in 0..m-1 {
print!(".");
} println!("#");
direction = !direction;
} else {
print!("#");
for _ in 0..m-1 {
print!(".");
} println!();
direction = !direction;
}
}
n -= 1;
}
}