complete 2083.rs 2530.rs 2721.rs 4128.rs 5584.rs 7512.rs 21519.rs 21964.rs 22862.rs 22973.rs 24123.rs 26993.rs 27514.rs 33849.rs

This commit is contained in:
2026-03-08 23:29:01 +09:00
parent 12445715dd
commit 94591886d6
14 changed files with 899 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
use std::io::stdin;
pub struct Person {
name: String,
age: u32,
weight: u32,
}
impl Person {
fn is_adult(&self) -> bool {
self.age >= 18 || self.weight >= 80
}
fn is_null(&self) -> bool {
self.age == 0 && self.weight == 0
}
}
fn main() {
let mut line = String::new();
loop {
line.clear();
stdin().read_line(&mut line).unwrap();
let mut iter = line.trim_ascii_end().split(' ');
let p = Person {
name: iter.next().unwrap().to_string(),
age: iter.next().unwrap().parse().unwrap(),
weight: iter.next().unwrap().parse().unwrap(),
};
if p.is_null() {
break;
} else if p.is_adult() {
println!("{} Senior", p.name);
} else {
println!("{} Junior", p.name);
}
}
}