20241004 finished.
This commit is contained in:
parent
e3a2d8f6f2
commit
f02363d377
|
@ -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;
|
30
src/problem/p1227_airplane_seat_assignment_probability.rs
Normal file
30
src/problem/p1227_airplane_seat_assignment_probability.rs
Normal 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));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user