ACM 数学题
青山绿水之辈
奋斗青春年华
展开
-
突然想到一道简单题,但也有深意!!
给出一个 n 第一个解法,费时:long long sum = 0 ; for (int n = 1; n <= 1000000000; n++) { if (n%3 == 0 || n%5 == 0) { sum += n ; } } printf(" %lld\n", sum);第二个解法,高原创 2017-08-03 23:25:08 · 612 阅读 · 4 评论 -
hdu2136Largest prime factor (关建在求素数,有点意思的题)
Problem DescriptionEverybody knows any number can be combined by the prime number.Now, your task is telling me what position of the largest prime factor.The position of prime 2 is 1, prime 3 is原创 2014-05-22 22:16:56 · 1177 阅读 · 0 评论 -
hdu1431素数回文
Problem Descriptionxiaoou33对既是素数又是回文的数特别感兴趣。比如说151既是素数又是个回文。现在xiaoou333想要你帮助他找出某个范围内的素数回文数,请你写个程序找出 a 跟b 之间满足条件的数。(5 <= a < b <= 100,000,000);Input这里有许多组数据,每组包括两组数据a跟b。 Output对每一原创 2014-05-12 21:52:44 · 1118 阅读 · 0 评论 -
ZOJ What day is that day? (找最小周期)
It's Saturday today, what day is it after 11 + 22 + 33 + ... +NN days? InputThere are multiple test cases. The first line of input contains an integer T indicating the number of test cases. Fo原创 2014-04-12 19:22:47 · 1544 阅读 · 0 评论 -
湘潭大学OJ1199Number Game(求一个集合的最小公倍数)
题目描述给你一个有N个数的集合S和一个数X,判断是否存在S的一个子集,子集里的数的最小公倍数正好是X。输入第一行是数据组数T。 接下来有多组数据,每组数据包含两行: 第一行有2个数N和X,1输出对于每一组数据,输出一行"Case #X: Y",X是第几组数据,Y是Yes或No。样例输入24 202 3 4 53 613 4 5样例输出Case #1:原创 2014-05-17 23:23:33 · 1608 阅读 · 0 评论 -
湘潭大学OJ1202逆序数(归律)
题目描述有n张卡片,分别标有数字1~n。有一天Silence把他们按某种序列排好,然后从第一张开始取出一张,再拿一张放到最后面,再取出一张,再拿出一张放到最后面...知道n张卡片全部取走。把取出的卡片按取出的顺序排好,正好是1,2,3,4,....,n。现在,告诉你n,Silence希望你帮他计算原来的序列的逆序数。例如,n=4时,原来的序列应该是1,3,2,4。这样,先取出卡片1,再原创 2014-05-17 23:29:18 · 1792 阅读 · 0 评论 -
ZOJ3768Continuous Login (等差求和公式+二分)
Pierre is recently obsessed with an online game. To encourage users to log in, this game will give users a continuous login reward. The mechanism of continuous login reward is as follows: If you have原创 2014-04-07 16:44:07 · 1264 阅读 · 0 评论 -
hdu2289Cup(神坑题,精度+二分,以半径二分不能过,以高度为二分就过了)
Problem DescriptionThe WHU ACM Team has a big cup, with which every member drinks water. Now, we know the volume of the water in the cup, can you tell us it height?The radius of the cup's top原创 2013-12-15 22:52:50 · 1011 阅读 · 0 评论 -
hdu2068RPG的错排
Problem Description今年暑假杭电ACM集训队第一次组成女生队,其中有一队叫RPG,但做为集训队成员之一的野骆驼竟然不知道RPG三个人具体是谁谁。RPG给他机会让他猜猜,第一次猜:R是公主,P是草儿,G是月野兔;第二次猜:R是草儿,P是月野兔,G是公主;第三次猜:R是草儿,P是公主,G是月野兔;......可怜的野骆驼第六次终于把RPG分清楚了。由于RPG的带动,做ACM的女生原创 2013-11-14 16:03:48 · 933 阅读 · 0 评论 -
hdu2058The sum problem
Problem DescriptionGiven a sequence 1,2,3,......N, your job is to calculate all the possible sub-sequences that the sum of the sub-sequence is M.InputInput contains multiple test cases. each原创 2013-11-14 21:47:37 · 2183 阅读 · 0 评论 -
acd LCM Challenge(求1~n的任意三个数的最大公倍数)
Problem DescriptionSome days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it.But I also don't want to use原创 2014-05-24 12:51:57 · 1423 阅读 · 2 评论 -
acd the cover circle(分情况讨论)
Problem Description用半径相等的两个圆覆盖一个w*h的矩形,要求两圆不相交且必须在矩形内。求覆盖面积最大时两圆半径。Input输入包含多组数据,EOF结束。每组数据包含一行,分别是两个实数w和h代表矩形的长和宽。0Output每组数据输出一行表示圆的半径,小数点后保留三位。Sample Input2.000 1.原创 2014-05-24 12:40:57 · 1192 阅读 · 0 评论 -
acd Convex(求面积)
Problem DescriptionWe have a special convex that all points have the same distance to origin point.As you know we can get N segments after linking the origin point and the points on the convex.原创 2014-05-24 12:45:56 · 1136 阅读 · 0 评论 -
1561: (More) Multiplication(模似)
1561: (More) MultiplicationTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 86 Solved: 48[Submit][Status][Web Board]DescriptionEducators are always coming up with new ways to teach ma原创 2015-04-06 19:00:40 · 794 阅读 · 0 评论 -
H. 硬币水题II
H. 硬币水题IITime Limit: 1000msCase Time Limit: 1000msMemory Limit: 65536KB64-bit integer IO format: %lld Java class name: MainSubmit Status PID: 29064Font Size: + -原创 2014-10-05 20:00:09 · 977 阅读 · 0 评论 -
BNUOJ34976数细菌
数细菌Time Limit: 1000msMemory Limit: 65536KBSpecial Judge64-bit integer IO format: %lld Java class name: MainPrev Submit Status Statistics Discuss NextFont Size: + -原创 2014-10-04 18:38:10 · 1602 阅读 · 0 评论 -
BNUOJ34977夜空中最亮的星(数学,向量的应用)
夜空中最亮的星Time Limit: 2000msMemory Limit: 65536KB64-bit integer IO format: %lld Java class name: MainPrev Submit Status Statistics Discuss NextFont Size: + -Type:原创 2014-10-04 18:28:56 · 1328 阅读 · 0 评论 -
HDU4961Boring Sum(在线更新方法)
Boring SumTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 446 Accepted Submission(s): 227Problem DescriptionNumber theory is in原创 2014-08-20 13:28:18 · 837 阅读 · 0 评论 -
hdu4506小明系列故事——师兄帮帮忙 (用二进制,大数快速取余)
Problem Description 小明自从告别了ACM/ICPC之后,就开始潜心研究数学问题了,一则可以为接下来的考研做准备,再者可以借此机会帮助一些同学,尤其是漂亮的师妹。这不,班里唯一的女生又拿一道数学题来请教小明,小明当然很高兴的就接受了。不过等他仔细读题以后,发现自己也不会做,这下小明囧了:如果回复说自己不懂,岂不是很没面子? 所以,他现在私下求你帮忙解决这道题目,题目是原创 2014-06-17 12:16:41 · 1132 阅读 · 0 评论 -
XTU 1178A+B
题目描述小明喜欢做a+b,所以也非常喜欢整数。有一天他看到练习册上的a+b,a和b居然变成了分数形式x/y,非常伤心。他想要是能把分式的分子和分母都加上一个非负整数z,使得分式能化成非负整数就好了。但是他不知道是不是存在这样z,请你帮他计算一下。输入第一行是一个整数K,表示样例的个数。以后每行一个样例,为两个整数x,y(1≤x,y≤1e9)。 输出每行输出一个样例的结果,存原创 2014-05-31 21:51:36 · 1522 阅读 · 0 评论 -
acd The Game about KILL(和约瑟夫归则一样,归律)
Problem DescriptionTeacher HU and his 40 students were trapped by the brigands. To show their power, the head of the brigands want to select one people to kill.Teacher HU and his 40 students wil原创 2014-05-24 13:00:57 · 1078 阅读 · 0 评论 -
hdu2199Can you solve this equation? (浮点型二分查找)
Problem DescriptionNow,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,can you find its solution between 0 and 100;Now please try your lucky.InputThe first line of the input contai原创 2013-11-24 15:49:54 · 1108 阅读 · 0 评论 -
poj1700Crossing River(这过河真经典)
DescriptionA group of N people wishes to go across a river with only one boat, which can at most carry two persons. Therefore some sort of shuttle arrangement must be arranged in order to row the原创 2013-11-24 19:36:33 · 5300 阅读 · 0 评论 -
hdu1163(求n的n次方的位根)
以前一直超时,看了之后原来可以用数学推出来!!!!!!以下为摘数学算法: 因为ab*ab=(10*a+b)*(10*a+b)=100*a*a+10*2*a*b+b*b=a*a+2*a*b+b*b=(a+b)*(a+b) abc*abc=(100*a+10*b+c)*(100*a+10*b+c)原创 2013-05-06 20:54:52 · 1292 阅读 · 0 评论 -
hdu1719(Friend)
Problem DescriptionFriend number are defined recursively as follows.(1) numbers 1 and 2 are friend number;(2) if a and b are friend numbers, so is ab+a+b;(3) only the numbers defined in (1) an原创 2013-05-19 22:51:37 · 1104 阅读 · 0 评论 -
hdu2566(统计硬币)
Problem Description假设一堆由1分、2分、5分组成的n个硬币总面值为m分,求一共有多少种可能的组合方式(某种面值的硬币可以数量可以为0)。Input输入数据第一行有一个正整数T,表示有T组测试数据;接下来的T行,每行有两个数n,m,n和m的含义同上。Output对于每组测试数据,请输出可能的组合方式数;每组输出占一行。原创 2013-05-18 22:42:09 · 1226 阅读 · 0 评论 -
hdu4237(数学规律)
#includeint main(){ int t,n,m,e; scanf("%d",&t); while(t--) { scanf("%d%d%d",&e,&n,&m); if(nn) printf("%d 0\n",e); if(m==0||m==n) p原创 2013-05-04 21:15:13 · 1029 阅读 · 0 评论 -
hdu1597
Problem Description假设:S1 = 1S2 = 12S3 = 123S4 = 1234.........S9 = 123456789S10 = 1234567891S11 = 12345678912............S18 = 123456789123456789..................现在我们把所有的串连接起原创 2013-05-17 19:34:49 · 1100 阅读 · 0 评论 -
hdu1178(科学记数法)
#includeint main(){ double sum; int k,n; while(scanf("%d",&n)==1&&n) { k=0; sum=(n+1)*1.0*n/6.0*(n+2);//必须用n/6.0才能过 while(sum>=10) {原创 2013-05-16 23:08:15 · 1072 阅读 · 0 评论 -
hdu1071(积分求面积)
Problem DescriptionIgnatius bought a land last week, but he didn't know the area of the land because the land is enclosed by a parabola and a straight line. The picture below shows the area. Now giv原创 2013-05-16 21:57:44 · 1110 阅读 · 0 评论 -
hdu1060(计算n^n最高位的数字)
看了别人的,这是怎么想出来的,还可以这样:#include#includeint main(){ int t; double n; __int64 m; scanf("%d",&t); while(t--) { scanf("%I64d",&m); n=m*log10(m*1.0)-(__int64)(m*l原创 2013-05-15 21:39:30 · 1086 阅读 · 0 评论 -
hdu1070(找最便宜的牛奶喝)
用结构体做#includetypedef struct{ char brand[102]; int price ,v,day; double f;}node;int main(){ node a[105]; int n,t,i,j,max; double min; scanf("%d",&t); while(t--)原创 2013-05-07 19:07:28 · 1284 阅读 · 0 评论 -
hdu4551(生日猜猜猜---坑的我好苦啊)
Problem Description小明对生日十分看重,因为他可以得到祝福,可以和朋友亲人一起分享快乐,可以为自己的人生做一次总结,并且...能够收到好多礼物!不过小明是个神秘的人,不会轻易告诉你他的生日,现在他想到一个办法,让你去猜他的生日是哪一天。小明会告诉你如下三个信息:1. 出生月份和出生日子的最大公约数;2. 出生月份和出生日子的最小公倍数;3. 出生年原创 2013-05-26 20:01:37 · 1397 阅读 · 0 评论 -
hdu1391(Number Steps )
Problem DescriptionStarting from point (0,0) on a plane, we have written all non-negative integers 0, 1, 2,... as shown in the figure. For example, 1, 2, and 3 has been written at points (1,1), (2,0原创 2013-07-17 15:44:54 · 1040 阅读 · 0 评论 -
hdu2522A simple problem (求1/n的值,有循环结,输出循环结前面部分)
Problem DescriptionZty很痴迷数学问题.。一天,yifenfei出了个数学题想难倒他,让他回答1 / n。但Zty却回答不了^_^. 请大家编程帮助他.Input第一行整数T,表示测试组数。后面T行,每行一个整数 n (1Output输出1/n. (是循环小数的,只输出第一个循环节).Sample Input423原创 2013-11-23 18:31:34 · 1085 阅读 · 0 评论 -
zoj3622Magic Number
A positive number y is called magic number if for every positive integerx it satisfies that put y to the right of x, which will form a new integerz, z mod y = 0.InputThe input has multiple cas原创 2013-11-16 20:09:50 · 1000 阅读 · 0 评论 -
hdu4515小Q系列故事——世界上最遥远的距离
Problem Description 世界上最遥远的距离 不是生与死 而是我就站在你面前 你却不知道我爱你 世界上最遥远的距离 不是我就站在你面前你却不知道我爱你 而是明明知道彼此相爱 却不能在一起 世界上最遥远的距离 不是明明知道彼此相爱却不能在一起 而是相约好了私奔的时间 我穿越到了未来 你却回去了古代原创 2013-08-15 15:20:46 · 887 阅读 · 0 评论 -
hdu1700 Points on Cycle (数学)
Problem DescriptionThere is a cycle with its center on the origin.Now give you a point on the cycle, you are to find out the other two points on it, to maximize the sum of the distance between eac原创 2013-08-15 15:24:29 · 1015 阅读 · 0 评论 -
SDUT2608(Alice and Bob)
题目描述 Alice and Bob like playing games very much.Today, they introduce a new game. There is a polynomial like this: (a0*x^(2^0)+1) * (a1 * x^(2^1)+1)*.......*(an-1 * x^(2^(n-1))+1). Then Al原创 2013-08-13 21:34:20 · 1183 阅读 · 0 评论 -
SDUTRescue The Princess(数学问题)
题目描述 Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry the princess set out immediately. Yet, the原创 2013-08-13 21:40:52 · 1018 阅读 · 0 评论