码迷,mamicode.com
首页 >  
搜索关键字:AC    ( 12438个结果
hdu 1301 Jungle Roads 一个很水的题 AC率也可以知道了 但是题目很难理解啊 英语渣o(╯□╰)oKruskal算法
The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessly, so the large road network is too expensive to maintain. Th...
分类:编程语言   时间:2015-02-23 15:31:52    阅读次数:212
hdu 1102 Constructing Roads 最小生成树Prim算法AC 水~~~
Problem Description There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are connected, if and only if there is a road between A and B, or t...
分类:编程语言   时间:2015-02-23 15:31:07    阅读次数:231
PAT:1015. 德才论 (25) AC
#include#include#includeusing namespace std;struct Student{ char mID[10]; int de,cai,sum; int tag; //标明是第几类:1德才都们组,2德胜才,3}STU[100010];bool c...
分类:其他好文   时间:2015-02-23 15:27:44    阅读次数:163
LeetCode Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.思路分析:这题很简单,基本就是以第一个字符串为标准,同时扫描后面的字符串对应index 字符是否相同,找到最大的相同前缀。但是实现的时候还是要注意一些corner case,比如输入数组为空或者只包含一个字符串的情况。AC Co...
分类:其他好文   时间:2015-02-23 12:02:19    阅读次数:145
HDOJ 1164 Eddy's research I
【题意】:对一个数进行因式分解。 【思路】:打表后一个一个除,最大数是65535,所以10000的质数范围苟用。 【AC代码】: #include #include #include #include #include #include using namespace std; #define MAX 10000 int cnt; int prime_list[MAX]; ...
分类:其他好文   时间:2015-02-23 09:42:40    阅读次数:173
HDOJ 1201 18岁生日
【思路】:无论如何都要经过18年,所以问题就是判断18年是否是闰年。注意:2月以后判断从下一年开始的18年,2月以前判断从今年开始的18年。另外还有一个2月29生日的特判。Ps.一年是365天,不是356天! 【AC代码】: #include #include #include #include #include #include using namespace std; int...
分类:其他好文   时间:2015-02-23 09:41:51    阅读次数:154
HDOJ 1194 Beat the Spread!
【题意】:给出两个数 m n,第一个数是另外两个数a b的和,第二个数是a b的差的绝对值(absolute difference)。输出这两个数a b,大的在前。 【思路】:大的数等于 (m+n)/2,小的等于m-大的。 【注意】:impossible的判断。分两种,一种是m如果m+n为奇数,则a b不存在。 【AC代码】: #include #include #include #...
分类:其他好文   时间:2015-02-23 09:40:29    阅读次数:118
HDOJ 1202 The calculation of GPA
【思路】:模拟。 【注意】:题目要求的是实型。并且题目有没说清楚的地方,全部缺考和学分*点数为0这两种情况都算GPA不存在! 参考:http://blog.csdn.net/liuzhushiqiang/article/details/8603798 【AC代码】: #include #include #include #include #include #include us...
分类:其他好文   时间:2015-02-23 09:39:08    阅读次数:220
HDOJ 1197 Specialized Four-Digit Numbers
【题意】:输出四位数中所有十进制=十二进制=十六进制的数。 【思路】:穷举就OK。避免重复可以再函数中增加一个位数的参数,这样三个函数写一个就行。 【AC代码】: #include #include #include #include #include #include using namespace std; int getDec(int x) { int sum =...
分类:其他好文   时间:2015-02-22 23:08:38    阅读次数:337
【POJ】2151 Check the difficulty of problems
http://poj.org/problem?id=2151题意:T个队伍M条题目,给出每个队伍i的每题能ac的概率p[i][j],求所有队伍至少A掉1题且冠军至少A掉N题的概率(T#include using namespace std;const int T=1005, M=35;double ...
分类:其他好文   时间:2015-02-22 23:05:10    阅读次数:161
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!