题目传送门:http://poj.org/problem?id=1579 Function Run Fun Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 20560 Accepted: 10325 Description We all love recursion! Don't we? Consider a three-parameter recursive function w(a, b, c): if a <=…
敌兵布阵 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 37773 Accepted Submission(s): 15923 Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了.A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就…
1.使用while循环输入 1 2 3 4 5 6 8 9 10 num = 1 while num<=10: if num ==7: num += 1 continue print(num) num += 1 2.求1-100的所有数的和 num = 1 sum = 0 while num<=100: sum += num num += 1 print(sum) 3.输出 1-100 内的所有奇数 num = 1 while num<=100: if num%2 ==0: nu…
P1478 陶陶摘苹果(升级版) 题目链接:https://www.luogu.com.cn/problem/P1478 题目大意:陶陶有s点体力值,每个苹果消耗体力值,问s体力值最多能摘多少苹果. 解题思路:首先过滤掉摘不到的苹果.其次从小到大排序, 贪心 思想:优先选择消耗体力值小的苹果. 实现代码如下: #include <bits/stdc++.h> using namespace std; const int maxn = 5050; int n, m, s, a, b, x[max…