摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=5122题意:就是经过几个回合可以使得序列变成有序的,求回合数。思路:数状数组。倒着插入,每次求和,判断在这个数前面是不是有数,只要有数就ans++;最后插入完,ans就是答案。 1 #include 2 #inc... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=5108找出最大质因子就可以。 1 #include 2 #include 3 #include 4 #define ll long long 5 #define N 100000 6 using namesp... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=5139思路:这道题要先找规律,f(n)=n!*(n-1)!*(n-2)!.....1!; 不能直接打表,而是离线处理,一次性处理出来。 1 #include 2 #include 3 #include 4 #... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=5154思路:有向图判断有没有环,可以用floyd。。 1 #include 2 #include 3 #include 4 using namespace std; 5 const int inf=1<<20... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=5144题意:给你初始的高度和速度,然后让你求出水平的最远距离。思路:三分枚举角度,然后根据公式求出水平距离。 1 #include 2 #include 3 #include 4 #include 5 us... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=5147题意:问有多少个这样的四元组(a,b,c,d),满足条件是 1 2 #include 3 #include 4 #define maxn 50001 5 #define ll long long 6 us... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=5146题意:判断这个序列是不是好的,好的要求是在奇数坐标上的数的和等于在偶数坐标上的数的和且这个序列不是回文序列。 1 #include 2 #include 3 #include 4 #define max... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=5151题意:一共有N个椅子,然后有N个学生依次去坐,满足下面三个条件不能坐上去,1:这个椅子旁边有左椅子也有右椅子,2:椅子旁边都有人坐了,3:椅子旁边的椅子颜色不一样。问如果所有人都坐上去有多少情况。dp[i][... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=5151直接判断是不是素数,然后再注意1就行。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int n; 7 int a[1001]... 阅读全文
摘要:
http://codeforces.com/contest/382/problem/C题意:给你n个数,然后让你添加一个数使得n+1个数能形成这样的规律,a[1]-a[0]=a[2]-a[1]=a[3]-a[2].....,问这样的数有多少个?输出出来。 1 #include 2 #inclu... 阅读全文