随笔分类 -  uva

摘要:题意:如果K个相邻素数p1,p2,p3.....pk满足pk-p1=s,称这些素数组成一个距离为s的素数K元组,输入a,b,k,s,输出区间[a,b]内距离为s的素数k元组的个数。思路:先打到50000素数表,然后暴力求出a,b区间的素数,然后判断。 1 #include 2 #include ... 阅读全文
posted @ 2015-01-21 16:13 null1019 阅读(353) 评论(0) 推荐(0)
摘要:题意:给你正整数n和k,然后计算从i到n k%i的和;思路;如果n小于1000000,直接暴力计算,然后大于1000000的情况,然后在讨论n和k的大小,根据k%i的情况,你会发现规律,是多个等差数列,然后你把这些等差数列加上就是答案。 1 #include 2 #include 3 #incl... 阅读全文
posted @ 2015-01-21 14:30 null1019 阅读(270) 评论(0) 推荐(0)
摘要:题意:能否在一个整数序列的每相邻的两项之间添加一个加减号,使得最终结果能被一个给定整数K 2 #include 3 #include 4 #define maxn 20000 5 using namespace std; 6 7 int t; 8 int n,k; 9 int a[maxn];... 阅读全文
posted @ 2014-10-13 19:50 null1019 阅读(182) 评论(0) 推荐(0)
摘要:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=975最小生成树。 1 #include 2 #include 3 #include 4 #includ... 阅读全文
posted @ 2014-10-13 18:57 null1019 阅读(141) 评论(0) 推荐(0)
摘要:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=973 1 #include 2 #include 3 #include 4 #define ll lo... 阅读全文
posted @ 2014-10-13 00:37 null1019 阅读(275) 评论(0) 推荐(0)
摘要:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=970通过对每一个字符串,每一个位置进行枚举三个操作,然后二分查找操作后的字符串是否存在,dp记录。 1 #... 阅读全文
posted @ 2014-10-12 22:14 null1019 阅读(189) 评论(0) 推荐(0)
摘要:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=967对价钱与天数比例排序,贪心即可。 1 #include 2 #include 3 #include ... 阅读全文
posted @ 2014-10-12 18:38 null1019 阅读(144) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 #include 5 #define ll long long 6 using namespace std; 7 8 int t; 9 10 int main()11 {12 scanf("%d",&t);... 阅读全文
posted @ 2014-10-12 17:58 null1019 阅读(190) 评论(0) 推荐(0)
摘要:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=961贪心,排序,对左端点贪,找最大右端点。 1 #include 2 #include 3 #inclu... 阅读全文
posted @ 2014-10-12 14:38 null1019 阅读(139) 评论(0) 推荐(0)
摘要:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=955根据递推公式推倒出a1的公式。a1=(n*a0+an+1-2*(n*c1+(n-1)*c2+...+cn... 阅读全文
posted @ 2014-10-11 22:32 null1019 阅读(135) 评论(0) 推荐(0)
摘要:题目意思: 给定m个圆的半径,现在要求找到一个矩形使得每一个球都以地面相切,要求输出最小的矩阵的长度 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 in... 阅读全文
posted @ 2014-10-11 20:09 null1019 阅读(210) 评论(0) 推荐(0)
摘要:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=948 卡特兰数*n! 1 import java.math.BigInteger; 2 import jav... 阅读全文
posted @ 2014-10-10 18:20 null1019 阅读(179) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1050对与每个房间前面过道,操作一次标记一次,标记的最多的次数就是必须用的时间。 1 #include 2 #include 3 #include 4 #define maxn 1000 5 using na... 阅读全文
posted @ 2014-10-09 21:08 null1019 阅读(126) 评论(0) 推荐(0)
摘要:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=947打出素数表,快速幂取模。 1 #include 2 #include 3 #include 4 #... 阅读全文
posted @ 2014-10-09 17:30 null1019 阅读(150) 评论(0) 推荐(0)