已注销
已注销
全部文章
题解
归档
标签
去牛客网
登录
/
注册
已注销的博客
有善始者实繁,能克终者盖寡。
全部文章
/ 题解
(共12篇)
牛牛与LCM【简单数论】
题意:中文题面,不需要解释了。思路:求出数组中能被x整除的数字的最小公倍数lcm,如果lcm%x==0,则可以找到,否则找不到。AC代码: #include<bits/stdc++.h> using namespace std; int lcm(int a,int b){ ret...
数论
2019-08-23
1
981
UVA-10905-Children's Game
题意:给定n个数,让你将他们重新组合使得它们组成的数字最大。思路:贪心,很容易想到的是按位的首个数字比较大小,相同则往后比,但是写起来好困难。。。正解:将他们用字符串读入,相邻数字只有两种情况,要么a+b,要么b+a,比较二者大小,最后输出即可。AC代码: #include<bits/stdc...
蓝书第一章题解
贪心
2019-08-23
0
507
A. BowWow and the Timetable
题意:给定二进制串,问你化为10进制后,包含几个4的K次方个数。AC代码:注意:100000000与1000这种情况就可以了。 #include<bits/stdc++.h> using namespace std; int main(void){ string s; c...
基础题
CodeForces题解
2019-08-21
0
485
B. Mislove Has Lost an Array
题意:给定n,让你构造一个数组,数组中的数字只有两种情况,是1或者存在其他数字是其他数字的两倍,数组中数字的种类数不能大于r,也不能小于l,输出数组中和的最小值与最大值。思路:最小值: 最大值:AC代码: #include<bits/stdc++.h> // n-l + 2的l加1...
基础题
CodeForces题解
2019-08-21
0
941
P1803 凌乱的yyy / 线段覆盖
题意:中文题面,不需要解释。思路:按比赛结束时间从小到大排序。AC代码: #include<bits/stdc++.h> using namespace std; const int maxn = 1e6+10; struct Node{ int s,e; }node[maxn]...
贪心
2019-08-19
0
529
P1094 纪念品分组
题意:中文题面,不需要解释了。思路:将纪念品件数从小到大排序,小的和大的一组,如果超过给定的上限,则大的单独一组。AC代码: #include<bits/stdc++.h> using namespace std; const int maxn = 3e4+10; int a[maxn]...
贪心
2019-08-19
0
457
P1223 排队接水
题意:中文题面,不需要解释了。思路:按时间从小到大排序即可。AC代码: #include<bits/stdc++.h> using namespace std; const int maxn = 1e3+10; struct Node{ int value,index; }nod...
贪心
2019-08-19
0
567
P1208混合牛奶 Mixing Milk
题意:中文题面,不需要解释了。思路:按金钱大小,从小到大排序即可。AC代码: #include<bits/stdc++.h> using namespace std; const int maxn = 5010; struct Node{ int x,y; }node[maxn]...
贪心
2019-08-19
0
451
P1181 数列分段Section I
题意:中文题面,不需要解释了。思路:贪心,对于当前元素只有两种选择 并到其他段上和单独一段。 并到其他段上:和小于M。 单独一段:和大于M。AC代码: #include<bits/stdc++.h> using namespace std; const int maxn = ...
贪心
2019-08-19
0
472
P1090 合并果子
题意:中文题面,不需要解释了。思路:这是一种哈夫曼型贪心,用优先队列即可。AC代码: #include<bits/stdc++.h> using namespace std; const int maxn = 10010; priority_queue<int,vector<...
贪心
2019-08-19
0
405
首页
上一页
1
2
下一页
末页