摘要:Counting GameThere are n people standing in a line, playing a famous game called ``counting". When the game begins, the leftmost person says ``1" loudly, then the second person (people are numbered 1 to n from left to right) says ``2" loudly. This is followed by the 3rd person saying
阅读全文
摘要:One-Two-ThreeYour little brother has just learnt to write one, two and three, in English. He has written a lot of those words in a paper, your task is to recognize them. Note that your little brother is only a child, so he may make small mistakes: for each word, there might be at most one wrong lett
阅读全文
摘要:字符串替换Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5975Accepted: 2795Description编写一个C程序实现将字符串中的所有"you"替换成"we"Input输入包含多行数据 每行数据是一个字符串,长度不超过1000 数据以EOF结束Output对于输入的每一行,输出替换后的字符串Sample Inputyou are what you doSample Outputwe are what we doSource#include<stdio.h>#in
阅读全文
摘要:开学以来,各种忙碌,好久没有刷题了。。。。今天在POJ刷了题,,,很简单分数加减法Time Limit: 1000MSMemory Limit: 65536KTotal Submissions: 8389Accepted: 2668Description编写一个C程序,实现两个分数的加减法Input输入包含多行数据 每行数据是一个字符串,格式是"a/boc/d"。 其中a, b, c, d是一个0-9的整数。o是运算符"+"或者"-"。 数据以EOF结束 输入数据保证合法Output对于输入数据的每一行输出两个分数的运算结果。 注意结
阅读全文
摘要:Regular PolygonTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 682Accepted Submission(s): 174Problem DescriptionIn a 2_D plane, there is a point strictly in a regular polygon with N sides. If you are given the distances between it and N vertexes of
阅读全文
摘要:N!Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 24579Accepted Submission(s): 6774Problem DescriptionGiven an integer N(0 ≤ N ≤ 10000), your task is to calculate N!InputOne N in one line, process to the end of file.OutputFor each N, output N! in
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4004本文作者 :kuangbin @SHU博客:www.cnblogs.com/kuangbin题意:一条长为l的河上有n个石头,告诉每个石头的位置,一个青蛙从头跳,求最少每次跳多少距离才能跳到对面。最多跳m次 解题策略:二分答案。。。其实二分的效率是很高的噢~~~~很常用的算法。。直接贴代码了:/*HDU 4004二分 */#include<stdio.h>#include<algorithm>using namespace std;#define MAXN 500010
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4001本文作者:kuangbin @SHU作者博客:www.cnblogs.com/kuangbin转载请注明出处。THX题意:小孩子玩积木堆房子的情景:每组测试数据第一行给出n,代表接下来有n块砖;接下来n行,每行给出砖的长,宽,高,属性(a,b,c,d);属性d:d=0:该砖的长度和宽度(a,b)要比垫在他下面的砖的长,宽大或者相等;就是长>=长,宽>=宽d=1:改砖的宽度和长度要比下面的砖的长度大或者相等,同时,该砖的宽度值和面积值要比下面的砖的面积值大;即长>=长,宽>
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4002本文作者:kuangbin作者博客:www.cnblogs.com/kuangbin 转载请注明出处。否则违法必究。。。保留最终解释权~~~~通过发现规律其实很简单。先是把前i个素数的乘积求出来,结果就是不超出n的素数和。题意:给出一个整数n,求一个数x,x在1到n之间,并且x/φ(x)最大(其中φ(x)为x的欧拉函数)。思路:由欧拉函数为积性函数,即:如果gcd(m , n) == 1,则有φ(m * n) == φ(m) * φ(n);且由φ(p^k) == (p - 1) * p^(k
阅读全文