init
This commit is contained in:
6
problems/p33/Cargo.toml
Normal file
6
problems/p33/Cargo.toml
Normal file
@@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "p33"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
33
problems/p33/src/main.rs
Normal file
33
problems/p33/src/main.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
fn is_non_trivial_fraction(up: u32, down: u32) -> bool {
|
||||
if !(10..100).contains(&up) {
|
||||
return false;
|
||||
}
|
||||
if !(10..100).contains(&down) {
|
||||
return false;
|
||||
}
|
||||
if up >= down {
|
||||
return false;
|
||||
}
|
||||
let up_1 = up % 10;
|
||||
let up_10 = up / 10;
|
||||
let down_1 = down % 10;
|
||||
let down_10 = down / 10;
|
||||
|
||||
// 两个个位相同不可能化简
|
||||
if up_1 == down_1 {
|
||||
return false;
|
||||
}
|
||||
|
||||
todo!();
|
||||
|
||||
true
|
||||
}
|
||||
#[test]
|
||||
fn test_is_non_trivial_fraction() {
|
||||
assert!(is_non_trivial_fraction(49, 98));
|
||||
assert!(!is_non_trivial_fraction(49, 99));
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
Reference in New Issue
Block a user