题解列表

筛选

3044: 电池的寿命

摘要:解题思路:当n等于2时,返回最小值, 当n大于2时,返回和的一半注意事项:返回最小值时将整数转化为浮点数,以保留一位小数参考代码:#include#include#includeusing names……

最大子矩阵

摘要:解题思路:二维前缀和注意事项:参考代码:#include<iostream> #include<algorithm>  #include<utility> using namespace std……

筛选法做题

摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int s[10000+1]; //值为1表示下标为 非寂寞数。值为0则表示下标为寂……

先帮助差值小的人完成任务

摘要:解题思路:注意事项:参考代码://设某个人拥有a个积木,需要b个积木。a-b就是积木差。a-b>=0表示这个人的积木足够了,a-b<0表示这个人需要等其它人完成后才能拿到足够的积木//把所有人的积木差……

注意时间要求

摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int ti[501];//n个人打水的时间,下标从1开始int   wat[100……

用string类直接秒了

摘要:```cpp #include #include using namespace std; int main() { string str; cin >> str; ……

反复使用sort函数

摘要:解题思路:反复使用sort函数注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int pa[101];int main(){   int n;……

3039: 分成互质组(递归)

摘要:解题思路:建立数组v记录组别, 遍历每一个数字, 分别和当前组别每一个数字判断是否有大于1的公约数, 如果没有,在v数组中标记该数字的组别, 如果有有, 递归下一个组别, 如果当前组别比 最大组别大,……