- 博客(9)
- 收藏
- 关注
原创 Codeforces233B Non-square Equation
DescriptionLet's consider equation:x2 + s(x)·x - n = 0, where x, n are positive integers, s(x) is the function, equal to the sum of digits of number x in the decimal number system.You are
2016-11-08 15:28:25
274
原创 HDU1233 还是畅通工程
Problem Description某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。 Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( 当N为0时,输
2016-08-21 19:57:22
219
原创 51nod1001 数组中和等于k的数对
1001 数组中和等于K的数对基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 收藏 关注给出一个整数K和一个无序数组A,A的元素为N个互不相同的整数,找出数组A中所有和等于K的数对。例如K = 8,数组A:{-1,6,5,3,4,2,9,0,8},所有和等于8的数对包括(-1,9),(0,8),(2,
2016-08-18 21:17:31
383
原创 51NOD1003 阶乘后面0的数量
1003 阶乘后面0的数量基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 收藏 关注n的阶乘后面有多少个0?6的阶乘 = 1*2*3*4*5*6 = 720,720后面有1个0。Input一个数N(1 Output输出0的数量Input示例
2016-08-18 21:01:11
353
原创 POJ1852 Ants
DescriptionAn army of ants walk on a horizontal pole of length l cm, each with a constant speed of 1 cm/s. When a walking ant reaches an end of the pole, it immediatelly falls off it. When two ant
2016-08-18 20:06:45
265
原创 51NOD1004 n^n的末位数字
给出一个整数N,输出N^N(N的N次方)的十进制表示的末位数字。Input一个数N(1 Output输出N^N的末位数字Input示例13Output示例3方法:快速幂,n的n次方对10取模。代码:#include#include#includeusing namespace std;int
2016-08-17 10:06:50
268
原创 HDU2084 数塔
数塔Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 36593 Accepted Submission(s): 21913Problem Description在讲述DP算法的时候,一个经典的例子就是数塔问题,
2016-08-09 15:48:10
173
原创 POJ1985 Cow Marathon
题意: 给出各农场之间的距离,求两个农场之间最大的距离。用两次BFS就可以了。#include #include #include using namespace std;const int maxn=80010;int n,m;int head[maxn];struct node{ int v,w,next;}edge[maxn];int cnt=0;
2016-08-02 20:58:16
272
原创 HDU1232 畅通工程
畅通工程Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 46783 Accepted Submission(s): 24899Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,
2016-08-02 10:28:16
297
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人