- 博客(10)
- 收藏
- 关注
原创 FZU 1607 数论题
<br />题目连接:http://acm.fzu.edu.cn/problem.php?pid=1607<br /> <br />思路:可以直接利用素数打表,然后分解质因数,计算因数的个数<br />最后个数-1就是答案,然后再枚举最小的因数就可以了<br /> <br />我的代码:<br /> <br />#include<stdio.h>#include<string.h>int prime[500000];int num=0;bool flag[1000005];voi
2011-04-27 21:09:00 861
原创 FZU 1988 二分+数论
<br />题目连接:http://acm.fzu.edu.cn/problem.php?pid=1988<br /> <br />这个题的关键在于计算G(x)<br />G(x)的计算方法很奇特,我现在也不能证明<br /> <br />在计算出G(x)之后我们就可以使用二分来寻找答案了<br /> <br />我的代码:<br />#include<stdio.h>#include<math.h>__int64 Count(__int64 n){ __int64 i;
2011-04-27 17:00:00 1125
原创 UVA 10090 扩展欧几里得算法
<br />题目连接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=12&problem=1031&mosmsg=Submission+received+with+ID+8778298<br /> <br />这道题的数据规模达到了惊人的2*10^9,所以得用long才能装得下而且只要有一丝的暴力思想就会TLE<br />仔细观察题目可以发现如果每一个盒子都要装满
2011-04-25 17:08:00 1877
原创 UVA 10168 把一个数n拆分成4个质数的和
<br />题目连接:<br />http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=13&problem=1109&mosmsg=Submission+received+with+ID+8770141<br /> <br />题目已经把题意说的很清楚了<br />就是把一个数n拆成4个质数的和<br />数据规模是10^7,所以直接打一个10^7的素数表是可行的(大概
2011-04-22 22:59:00 3791
原创 UVA 10139 判断n的阶乘能否被m整除
<br />题目连接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=13&problem=1080&mosmsg=Submission+received+with+ID+8769167<br /> <br />题意不解释了,直接说方法。<br />首先观察数据范围,loss than 2^31次方,所以一般的暴力算法肯定会超时的,故需要从阶乘的本质入手<br />
2011-04-22 17:37:00 3562
原创 UVA 10006 判断一个数是否为一个卡米切尔数
<br />题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=12&problem=947&mosmsg=Submission+received+with+ID+8768565<br /> <br />这个题目应该是数论中比较入门的题目了<br />因为数据量并不是很大,所以可以直接暴力的打出素数表,然后进行判断<br />不过在取mod的时候可以把线性的乘
2011-04-22 14:07:00 2157
原创 UVA 10099 最大的最小边。。
<br />题目连接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=12&problem=1040&mosmsg=Submission+received+with+ID+8760564<br /> <br />这个题很YD,之前一直不知道导游还要占一个容量,所以连样例都搞不懂。。悲催。。<br />解法是利用floyd算法,最后求出那条边之后再做一下出发就OK了<
2011-04-19 23:11:00 1640
原创 UVA 10004判断一个图是否为二分图
Bicoloring <br />In 1976 the ``Four Color Map Theorem" was proven with the assistance of a computer. This theorem states that every map can be colored using only four colors, in such a way that no region is colored using the same color as a neighbor regi
2011-04-19 18:35:00 1559
原创 UVA 10196 模拟题。。
<br />题目连接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=13&problem=1137&mosmsg=Submission+received+with+ID+8744125<br />题意很简单,就是判断king有木有被攻击<br />可以直接模拟<br />我的代码:(写的又臭又长。。)<br />#include<stdio.h>#includ
2011-04-14 14:38:00 883
原创 POJ 2001 字典树
<br />题目连接:http://poj.org/problem?id=2001<br />记录每个字母出现的次数就可以了~<br /> <br />Source CodeProblem:2001 User:bingshenMemory: 1220K Time: 32MSLanguage: C++ Result:AcceptedSource Code#include<stdio.h>#include<string.h>structnode{int num;int data[26];voidinit();}
2011-04-05 22:47:00 871 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人