20241004 finished.

This commit is contained in:
jackfiled 2024-10-04 14:29:33 +08:00
parent e3a2d8f6f2
commit f02363d377
2 changed files with 32 additions and 1 deletions

View File

@ -253,4 +253,5 @@ mod p2073_time_needed_to_buy_tickets;
mod p1845_seat_reservation_manager; mod p1845_seat_reservation_manager;
mod p983_minimum_cost_for_tickets; mod p983_minimum_cost_for_tickets;
mod p1870_minimum_speed_to_arrive_on_time; mod p1870_minimum_speed_to_arrive_on_time;
mod p1928_minimum_cost_to_reach_destination_in_time; mod p1928_minimum_cost_to_reach_destination_in_time;
mod p1227_airplane_seat_assignment_probability;

View File

@ -0,0 +1,30 @@
/**
* [1227] Airplane Seat Assignment Probability
*/
pub struct Solution {}
// submission codes start here
impl Solution {
pub fn nth_person_gets_nth_seat(n: i32) -> f64 {
if n == 1 {
1f64
} else {
0.5
}
}
}
// submission codes end
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_1227() {
assert_eq!(1f64, Solution::nth_person_gets_nth_seat(1));
assert_eq!(0.5, Solution::nth_person_gets_nth_seat(2));
}
}