- 博客(20)
- 收藏
- 关注
转载 HDOJ-1019 Least Common Multiple
http://acm.hdu.edu.cn/showproblem.php?pid=1019题意:给出n个数,求它们的最小公倍数对于n个数,它们的最小公倍数等于【前n-1个数的最小公倍数和第n个数】的最小公倍数而前n-1个数的最小公倍数又等于【前n-2个数的最小公倍数和第n-1个数】的最小公倍数以此类推..所以,从第1和第2个数开始依次求出最小公倍数,然后迭代即...
2015-04-28 20:00:00
101
转载 HDOJ-1018 Big Number
http://acm.hdu.edu.cn/showproblem.php?pid=1018题意:给出一个数n,输出n的阶乘的位数汗Σ( ° △ °|||)︴刚开始还准备上大数乘法 然而10000的阶乘结果就已经接近40000位10^7的阶乘...正:对于一个数n 求其位数可以用 log10(n) + 1 求得所以 对于N! 其位数= log10(1*2*...*(N-1)*...
2015-04-28 19:47:00
121
转载 HDOJ-1017 A Mathematical Curiosity(淼)
http://acm.hdu.edu.cn/showproblem.php?pid=1017# include <stdio.h>int find(int n, int m){ int count = 0; for(int i = 1; i < n; i++) { for(int j = i + 1; j < n; j++)...
2015-04-28 19:41:00
108
转载 HDOJ-1016 Prime Ring Problem(DFS)
http://acm.hdu.edu.cn/showproblem.php?pid=1016题意:输入n,代表有一个包含n个节点的环,在环中的节点中填入1,2...n-1,n,要求填入的数与左边的数之和,与右边的数之和,都为素数输出所有符合要求的环(第一个数总为1)用DFS模拟,从第2位到第n位依次选取一个与上一个选取的数之和为素数的数直到选取完第n个数,判断第n个...
2015-04-28 19:32:00
112
转载 HDOJ-1015 Safecracker(DFS)
http://acm.hdu.edu.cn/showproblem.php?pid=1015题意:给出一个目标值target和一个由大写字母组成的字符串 A-Z分别对应权值1-26要求从给出的字符串中选出5个字符,它们的权值v,w,x,y,z应符合下列式子v - w^2 + x^3 - y^4 + z^5 = target同一个字符只能被选取一次输出符合要求的5个字符...
2015-04-28 17:31:00
107
转载 HDOJ-1014 Uniform Generator
http://acm.hdu.edu.cn/showproblem.php?pid=1014给出式子seed(x+1) = [seed(x) + STEP] % MODseed初始为0,给出STEP和MOD的值问seed能否取到0~(MOD - 1)之间的所有值简单模拟# include <stdio.h>int main(){ int...
2015-04-28 16:38:00
83
转载 HDOJ-1013 Digital Roots
http://acm.hdu.edu.cn/showproblem.php?pid=10131.给出一个整数,求每一位上的数字之和2.若求出的和大于1位,则对该和继续执行第1步,直至和的位数为1注意:该整数有可能远远大于int或__int64的取值范围,所以用字符数组处理# include <stdio.h># include <string.h...
2015-04-26 10:21:00
88
转载 HDOJ-1012 u Calculate e(水)
http://acm.hdu.edu.cn/showproblem.php?pid=1012简单套公式# include <stdio.h>double Factorial(double num){ if(num == 0 || num == 1) return 1; return Factorial(num - 1) * num;}...
2015-04-26 09:23:00
96
转载 HDOJ-1010 Tempter of the Bone(dfs+剪枝)
http://acm.hdu.edu.cn/showproblem.php?pid=1010给出一个n*m的迷宫 X为墙 .为空地 S为起点 D为终点 给出时间T每走一步花费一单位的时间 走过的空地会消失不能再次经过问能不能刚好花费T单位时间到达终点(在T时间前到达终点也算失败)典型深搜 为减少时间花费加点剪枝1.奇偶剪枝:给出一个01矩阵如下从0到0或从1...
2015-04-16 15:23:00
143
转载 HDOJ-1009 FatMouse' Trade
http://acm.hdu.edu.cn/showproblem.php?pid=1009# include <stdio.h># include <algorithm># define MAX 1010using namespace std;struct NODE{ int j, f; double avg;}foo...
2015-04-13 22:35:00
134
转载 HDOJ-1008 Elevator
http://acm.hdu.edu.cn/showproblem.php?pid=1008//模拟 无亮点# include <stdio.h>int main(){ int n; while(scanf("%d",&n) && n) { int Target, Last = 0, Time = 0; ...
2015-03-22 12:31:00
115
转载 HDOJ-1042 N!(大数乘法)
http://acm.hdu.edu.cn/showproblem.php?pid=1042题意清晰..简单明了开门见山的大数乘法..10000的阶乘有35000多位 数组有36000够了# include <stdio.h># include <string.h># define MAX 36000int BigNum[MA...
2015-02-21 22:24:00
112
转载 HDOJ-1041 Computer Transformation(找规律+大数运算)
http://acm.hdu.edu.cn/showproblem.php?pid=1041有一个初始只有一个1的串 每次都按①0 -> 10;②1 -> 01;这两条规则进行替换形如:n = 1 1 n = 2 01 n = 3 1001 ...求经过n步替换之后 串中只含复数个0的连续子串(不难发现,这种子串只能是‘00’)的出现...
2015-02-21 21:25:00
180
转载 HDOJ-1007 Quoit Design(最近点对问题)
http://acm.hdu.edu.cn/showproblem.php?pid=1007给出n个玩具(抽象为点)的坐标 求套圈的半径 要求最多只能套到一个玩具实际就是要求最近的两个坐标的距离典型的最近点对问题最近点对详解http://blog.youkuaiyun.com/lonelycatcher/article/details/7973046//最近点对...
2015-02-21 15:25:00
114
转载 HDOJ-1005 Number Sequence
http://acm.hdu.edu.cn/showproblem.php?pid=1005给出两个初值f(1) = 1;f(2) = 1和 递推公式f(n) = (a * f(n - 1) + b * f(n - 2)) % 7输入a,b,n 要求输出f(n)1 <= n <= 100,000,000这个限制条件表示直接迭代n次注定是超时的结局由迭代公式...
2015-02-21 00:58:00
111
转载 HDOJ-1004 Let the Balloon Rise
http://acm.hdu.edu.cn/showproblem.php?pid=1004输入N个字符串 输出出现频率最高的字符串# include <stdio.h># include <string.h># define MAX 1005struct BALLOON{ char Color[20]; int Time...
2015-02-20 22:48:00
80
转载 HDOJ-1003 Max Sum(最大连续子段 动态规划)
http://acm.hdu.edu.cn/showproblem.php?pid=1003给出一个包含n个数字的序列{a1,a2,..,ai,..,an},-1000<=ai<=1000求最大连续子段和及其起始位置和终止位置,很基础的动态规划(DP)问题,看完DP第一次做的DP题目DP真的是一种很优美的算法,或者说思想,但是比较难理解,我对DP的理解还很浅薄...
2015-02-20 18:09:00
124
转载 HDOJ-1002 A + B Problem II (非负大整数相加)
http://acm.hdu.edu.cn/showproblem.php?pid=1002输入的数都是正整数,比较好处理,注意进位。//非负大整数加法# include <stdio.h># include <string.h># define MAX 1100int main(){ int t; char Num...
2015-02-20 16:56:00
134
转载 HDOJ-1001 Sum Problem
http://acm.hdu.edu.cn/showproblem.php?pid=1001# include <stdio.h>int main (){ int n; while(scanf("%d",&n) != EOF) { int Sum = 0; for(int i = 1; i <= n; i++) ...
2015-02-20 16:05:00
143
转载 HDOJ-1000 A + B Problem
http://acm.hdu.edu.cn/showproblem.php?pid=1000# include <stdio.h>int main(){ __int64 a, b; while(scanf("%I64d %I64d",&a, &b) != EOF) printf("%I64d\n",a + b); ...
2015-02-20 15:00:00
115
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人