complete 25551.rs 26031.rs 34928.rs

This commit is contained in:
2025-12-29 02:01:34 -08:00
parent e417121e2a
commit e046497aca
3 changed files with 120 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
use std::{
cmp::min,
io::{stdin, Read},
};
fn main() {
let mut line = String::new();
stdin().read_to_string(&mut line).unwrap();
let mut iter = line
.trim()
.split_ascii_whitespace()
.map(|x| x.parse::<i64>().unwrap());
let (mw, mb, tw, tb, pw, pb) = {
(
iter.next().unwrap(),
iter.next().unwrap(),
iter.next().unwrap(),
iter.next().unwrap(),
iter.next().unwrap(),
iter.next().unwrap(),
)
};
let s1 = min(tw, min(mb, pb));
let s2 = min(tb, min(pw, mw));
let res = if s1 == s2 {
s1 + s2
} else if s1 > s2 {
2 * s2 + 1
} else {
2 * s1 + 1
};
println!("{}", res);
}