随笔分类 - ACM杂谈
hud 1012 u Calculate e
摘要:Problem DescriptionA simple mathematical formula for e iswhere n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively small values of n.OutputOutput the approximations of e generated by the above formula for the values of n from 0 to 9. The beginni
阅读全文
.hdu 1005 Number Sequence
摘要:/*做题方法: 前是打表,就是打出一大堆数据,然后发现规率:发现这道题是从f[1]=1,和f[2]=1开始,然后依次模7,就可知f[n]只有7种情况,而相数相邻只有7*7=49种,所以从f[1]到f[49]必会出现相邻两个f[m-1]=1,f[m]=1,所以f[m]为周期函数,49为其一个周期;代码如下:*/#include<stdio.h>int main(){ int f[56],a,b,i; f[0]=1;f[1]=1; int n; while(1) { scanf("%d%d%d",&a,&b,&n); if(!a &&
阅读全文
辗转相除法求最大公约数
摘要:int a,b;while(1){if(a%b==0){r=b;break;}else{r=a%b;a=b;b=r;}r就是最大公约数~~~~~
阅读全文
HDU 考试排名
摘要:Problem DescriptionC++编程考试使用的实时提交系统,具有即时获得成绩排名的特点。它的功能是怎么实现的呢?我们做好了题目的解答,提交之后,要么“AC”,要么错误,不管怎样错法,总是给你记上一笔,表明你曾经有过一次错误提交,因而当你一旦提交该题“AC”后,就要与你算一算帐了,总共该题错误提交了几回。虽然你在题数上,大步地跃上了一个台阶,但是在耗时上要摊上你共花去的时间。特别是,曾经有过的错误提交,每次都要摊上一定的单位时间分。这样一来,你在做出的题数上,可能领先别人很多,但是,在做出同样题数的人群中,你可能会在耗时上处于排名的劣势。例如:某次考试一共8题(A,B,C,D,E,F
阅读全文
北大poj ——487-3279(1002)
摘要:DescriptionBusinesses like to have memorable telephone numbers. One way to make a telephone number memorable is to have it spell a memorable word or phrase. For example, you can call the University of Waterloo by dialing the memorable TUT-GLOP. Sometimes only part of the number is used to spell a wo
阅读全文
浙公网安备 33010602011771号