题目链接 可以暴力找一下规律 比如,假设N=7,两人有5题相同,2题不同,枚举X=0->15时,Y的"Not lying"的取值范围从而找出规律 #include<bits/stdc++.h> using namespace std; typedef long long LL; int T; int N,X,Y; string D,A; int main() { ios::sync_with_stdio(false); cin>>T; while(T--)…
/* HDU 6045 - Is Derek lying [ 分析 ] 题意: 有N个问题, 每个问题有A,B,C三种答案,答对加一分,答错不加分 给出甲乙两人的答案,给出两人的分数先x, y,问分数是否正确 分析: 统计甲乙相同的答案数目为 a, 不同的答案数目为 b 若甲的分数为x,则y能取到的最小值为 max(0, x-b),即甲答对的题目尽量在b中 y能取到的最大值为 b-max(0,x-a)+min(x,a) ,即甲答对的题目尽量在a中,答错的尽量在b中 编码时长:32分钟(-1) *…
题目网址:http://acm.hdu.edu.cn/showproblem.php?pid=6045 题目: Is Derek lying? Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 104    Accepted Submission(s): 65 Problem Description Derek and Alfia are…
题目链接 Problem Description Derek and Alfia are good friends.Derek is Chinese,and Alfia is Austrian.This summer holiday,they both participate in the summer camp of Borussia Dortmund.During the summer camp,there will be fan tests at intervals.The test co…
Problem Description Derek and Alfia are good friends.Derek is Chinese,and Alfia is Austrian.This summer holiday,they both participate in the summer camp of Borussia Dortmund.During the summer camp,there will be fan tests at intervals.The test consist…
题目链接 可以贪心写,先把b数组按从小到大的顺序排个序,根据b[i]的值来产生a[n+i] 借助一个c数组,c[i]记录,j从i到n,a[j]-j的最大值,再加上一个实时更新的变量ma,记录从n+1到当前之前的a[n+i]-(n+i)的最大值,每次把max(c[b[i]],ma)的值赋给a[n+i] #include<bits/stdc++.h> using namespace std; typedef long long LL; ; ; int n; int a[N],b[N],c[N];…
题目链接 暴力打个表找下规律就好了,比赛时看出规律来了倒是,然而看这道题看得太晚了,而且高中的那些数列相关的技巧生疏了好多,然后推公式就比较慢..其实还是自身菜啊.. 公式是 #include<bits/stdc++.h> using namespace std; typedef long long LL; ; LL qpow(LL x,LL n) //求x^n%mod { LL ret=; ) { ) ret=ret*x%mod; x=x*x%mod; } return ret; } LL…
题目链接 定义f[n]表示n是最大公约数情况下的计数,F[n]为n是公约数情况下的计数 (可以和 http://www.cnblogs.com/Just--Do--It/p/7197788.html hdu1695 进行类比) 显然F[n]和f[n]是满足下面这个关系的 所以,可以用下面这个公式求解f[n] 得到下面的AC代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; #define max(a,b)…
题目链接 有个结论: 平面坐标系上,坐标为整数的情况下,n个点组成正n边形时,只可能组成正方形. 然后根据这个结论来做. 我是先把所有点按照 x为第一关键字,y为第二关键字 排序,然后枚举向量 (p[i]->p[j]) (j>i),只判断这个向量左侧可否存在两个点与它一起构成一个正方形.这样算的结果是,计数每个正方形时,它的靠右和靠下的两条边都会为ans贡献一个单位,所以最后ans要除以2. #include<bits/stdc++.h> using namespace std;…
这题官方结题报告一直在强调不难,只要注意剪枝就行. 这题剪枝就是生命....没有最优化剪枝就跪了:如果当前连续切割数加上剩余的所有切割数没有现存的最优解多的话,不需要继续搜索了 #include <cstdio> #include <iostream> #include <cmath> #include <cstring> #include <algorithm> # define MAX 33 using namespace std; stru…