// A != B
// 1 <= A, B <= 1000
// 1 <= C, D <= 1000
// C != A
// C != B
// D != A
// D != B
// C != D
use std::io;
use std::io::BufRead;
const M: u32 = 500;
fn f(x: u32) -> u32 {
2 * M - x + 1
}
fn operation(x: u32, y: u32) -> (u32, u32) {
(f(x), f(y))
}
fn main() {
let stdin = io::stdin().lock();
let mut lines = stdin.lines();
let name = lines.next().unwrap().unwrap();
let operation = match name.as_str() {
"Algosia" => operation,
"Bajtek" => operation,
_ => panic!("Unknown name: {}", name),
};
let nums = lines.next().unwrap().unwrap();
let nums: Vec<u32> = nums
.split_whitespace()
.map(|s| s.parse().unwrap())
.collect();
let (a, b) = (nums[0], nums[1]);
let (c, d) = operation(a, b);
println!("{} {}", c, d);
}
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 | // A != B // 1 <= A, B <= 1000 // 1 <= C, D <= 1000 // C != A // C != B // D != A // D != B // C != D use std::io; use std::io::BufRead; const M: u32 = 500; fn f(x: u32) -> u32 { 2 * M - x + 1 } fn operation(x: u32, y: u32) -> (u32, u32) { (f(x), f(y)) } fn main() { let stdin = io::stdin().lock(); let mut lines = stdin.lines(); let name = lines.next().unwrap().unwrap(); let operation = match name.as_str() { "Algosia" => operation, "Bajtek" => operation, _ => panic!("Unknown name: {}", name), }; let nums = lines.next().unwrap().unwrap(); let nums: Vec<u32> = nums .split_whitespace() .map(|s| s.parse().unwrap()) .collect(); let (a, b) = (nums[0], nums[1]); let (c, d) = operation(a, b); println!("{} {}", c, d); } |
English