complete 9437.rs 12082.rs 12083.rs 12149.rs 17245.rs

This commit is contained in:
2026-01-07 23:24:14 -08:00
parent 10119a8a3a
commit 73240ede3f
5 changed files with 386 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
use std::io::stdin;
fn main() {
let mut line = String::new();
loop {
line.clear();
stdin().read_line(&mut line).unwrap();
let mut iter = line
.trim()
.split(' ')
.map(|x| x.trim().parse::<usize>().unwrap());
let n = iter.next().unwrap();
if n == 0 {
break;
}
let p = iter.next().unwrap();
let mut res = vec![];
if p % 2 == 0 {
res.push(p - 1);
res.push(n + 1 - p + 1);
res.push(n + 1 - p);
} else {
res.push(p + 1);
res.push(n - p);
res.push(n + 1 - p);
}
res.sort();
println!("{} {} {}", res[0], res[1], res[2]);
}
}