void-man

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2011年4月15日

摘要: MiYu原创, 转帖请注明 : 转载自 ______________白白の屋题目地址 :http://acm.hdu.edu.cn/showproblem.php?pid=1133题目描述:ProblemDescriptionThe"HarryPotterandtheGobletofFire"willbeonshowinthenextfewdays.AsacrazyfanofHarryPotter,youwillgotothecinemaandhavethefirstsight,won’tyou?Supposethecinemaonlyhasoneticket-office 阅读全文
posted @ 2011-04-15 22:43 void-man 阅读(304) 评论(0) 推荐(0)

摘要: 给出新的数列:another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2)第n个斐波那契数列是否能被3整除...找规律问题,找出规律后发现8个行程循环,第三个和第七个可以被三整除1 #include <stdio.h>2 int main()3 {4 int n;5 while(scanf("%d",&n)!=EOF)6 if((n+1)%8==3||(n+1)%8==7)printf("yes\n");7 else p 阅读全文
posted @ 2011-04-15 22:30 void-man 阅读(334) 评论(0) 推荐(0)

摘要: 给出一个数,要求分拆成最多的数的和,并且每一个数都不同...既然要求最多并且不同,那就尽量要连续给出,并且把剩余的数依次给最后的几个数上每次加一,得到序列即可 1 #include<stdio.h> 2 int main() 3 { 4 int n,arr[1001],i,j,t; 5 6 while(scanf("%d",&t)!=EOF){ 7 while(t--) 8 { 9 scanf("%d",&n);10 int wei=0,c=2;11 while(1)12 {13 if(n<c)break;14 arr[ 阅读全文
posted @ 2011-04-15 22:25 void-man 阅读(182) 评论(0) 推荐(0)

摘要: 阶乘0的个数,就看乘数中出现5的因子个数为了求从1-n的之前的数中含有5的个数,可以依次把n除以5,所得结果相加即可 1 #include <stdio.h> 2 int main() 3 { 4 int t,n,k; 5 scanf("%d",&t); 6 while(t--) 7 { 8 k=0; 9 scanf("%d",&n);10 while(n)11 {12 n=n/5;13 k+=n;14 }15 printf("%d\n",k);16 17 }18 19 return 0;20 } 阅读全文
posted @ 2011-04-15 22:15 void-man 阅读(158) 评论(0) 推荐(1)

摘要: 给出一个矩形箱子的长宽,然后再给出一个矩形的长宽,问你第二个是否能放到第一个里面,题目要求不能接触到box的trap比较简单,但是很多细节需要注意,当然斜着放是最容易进去,然后设角度theta,取值在0-90之前,依次逼近看是否能存在放进去的可能...首先可以确定如果y>B的话,它就肯定放不进去 1 #include<iostream> 2 #include<algorithm> 3 #include<math.h> 4 #include<stdio.h> 5 6 using namespace std; 7 8 #define PI ac 阅读全文
posted @ 2011-04-15 22:08 void-man 阅读(223) 评论(0) 推荐(0)

摘要: 每次在用的时候对数据类型范围很模糊,到底会不会溢出,该不该用long long之类的,这次找了相关资料给总结下char1-128到126 unsignedchar10到255 short2-32,768到32,767 unsignedshort20到65,535 long4-2,147,483,648到2,147,483,648 unsignedlong40到4,294,967,295 int4同long unsignedint4同unsignedlong float41.2E-38到3.4E381 double82.2E-308到1.8E3082 bool1true或falselong lo 阅读全文
posted @ 2011-04-15 00:05 void-man 阅读(2598) 评论(0) 推荐(0)