LeetCode | 1227. Airplane Seat Assignment Probability(概率题 一行代码 C++)

Description

原题链接
在这里插入图片描述

Algorithm


详细解释请看
【每日算法Day 68】脑筋急转弯:只要一行代码,但你会证吗?

C++ Solution

class Solution {
public:
    double nthPersonGetsNthSeat(int n) {
        return n == 1 ? 1 : 0.5;
    }
};
发布了308 篇原创文章 · 获赞 149 · 访问量 15万+

猜你喜欢

转载自blog.csdn.net/qq_43827595/article/details/104840243
今日推荐