题目: 题解: func getMoneyAmount(n int) int {f := make([][]int, n+1)for i := range f {f[i] = make([]int, n+1)}for i := n - 1; i >= 1; i-- {for j := i + 1; j <= n; j++ {f[i][j] = j + f[i][j-1]for k := i
题目链接:spoj 375. Query on a tree 题目大意: poj 3237的简化版,用同一份代码都能过。 解题思路:略。 #include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 10005;const int INF = 0x3f3
D. Lakes in Berland time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The map of Berland is a rectangle of the size n × m
A 统计已测试设备 模拟:记录当前已测试设备数量 class Solution {public:int countTestedDevices(vector<int> &batteryPercentages) {int res = 0;int s = 0;for (auto x: batteryPercentages) {if (x - s > 0) {res++;s++;}}re