Finished abc051 b very dirty, first look at c
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
use proconio::input;
|
||||
use std::cmp::min;
|
||||
|
||||
fn solve(k: u32, s: u32) -> u32 {
|
||||
let mut result = 0;
|
||||
let low = s - min(s, 2 * k);
|
||||
|
||||
for i in low..=k {
|
||||
for j in low..=k {
|
||||
for h in low..=k {
|
||||
if i + j + h == s {
|
||||
result += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -13,7 +25,6 @@ fn main() {
|
||||
};
|
||||
|
||||
assert!(s <= 3 * k);
|
||||
|
||||
println!("{}", solve(k, s));
|
||||
|
||||
println!("{}", solve(k, s));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
use proconio::input;
|
||||
|
||||
fn main() {
|
||||
unimplemented!();
|
||||
input!{
|
||||
sx: i32,
|
||||
sy: i32,
|
||||
tx: i32,
|
||||
ty: i32,
|
||||
};
|
||||
|
||||
assert!(sx < tx && sy < ty);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user