摘要: 套并查集模板就ojbk/*Sample Input25 31 22 34 55 12 5Sample Output24*/#include using namespace std;int pre[1005];int Find(int x){ int p,tmp;... 阅读全文
posted @ 2018-04-23 23:20 MCQ 阅读(96) 评论(0) 推荐(0) 编辑
摘要: #include #includeusing namespace std;int main(void){ int dec_sum=0,hex_sum=0,duo_sum=0,dec_temp,hex_temp,duo_temp; for(int i=100... 阅读全文
posted @ 2018-04-23 18:12 MCQ 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 解题思路:考虑两种糖果,假设其中一种最大数量为n,要想这两种糖果交替吃完,则另一种糖果最少的数量为n-1.因为n个糖果排成一排,内部一共有n-1个空,分离相邻的两个相同的糖果。回到题目中,找出某种糖果的最大数量maxvalue,至少需要maxvalue-1个糖果(即除... 阅读全文
posted @ 2018-04-23 18:04 MCQ 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 第一种(大数)#include#includeusing namespace std;const int MAXN = 1000;int t[MAXN], A[MAXN];char OldData[MAXN], NewData[MAXN]; // 转换前、后的数据... 阅读全文
posted @ 2018-04-23 13:03 MCQ 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 细节很多,可以先算365*18再判断其他的情况再分别加一#include #includeusing namespace std;bool ifrun(int n){ if((n%4==0&&n%100!=0) ||n%400==0) return... 阅读全文
posted @ 2018-04-23 00:27 MCQ 阅读(293) 评论(0) 推荐(0) 编辑