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