2954专题

POJ 2954 Triangle (Pick定理)

http://poj.org/problem?id=2954 完整代码: /*0ms,356KB*/#include<cstdio>#include<cstdlib>#include<cmath>int x[4], y[4];int gcd(int a, int b){return b ? gcd(b, a % b) : a;}double s(){double ret =

[组合数学]LeetCode:2954:统计感冒序列的数目

作者推荐 [二分查找]LeetCode2040:两个有序数组的第 K 小乘积 题目 给你一个整数 n 和一个下标从 0 开始的整数数组 sick ,数组按 升序 排序。 有 n 位小朋友站成一排,按顺序编号为 0 到 n - 1 。数组 sick 包含一开始得了感冒的小朋友的位置。如果位置为 i 的小朋友得了感冒,他会传染给下标为 i - 1 或者 i + 1 的小朋友,前提 是被传染的小朋

Leetcode 2954. Count the Number of Infection Sequences

Leetcode 2954. Count the Number of Infection Sequences 1. 解题思路2. 代码实现 题目链接:2954. Count the Number of Infection Sequences 1. 解题思路 这道题其实思路上还是挺简单的,就是一个数学问题,还是那种不太难的数学问题。 显然, m m m个生病的人将所有的 n n n个人分成了