2012年6月19日

codeforces 1A

摘要: A. Theatre Squaretime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputTheatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the 阅读全文

posted @ 2012-06-19 23:38 yumao 阅读(236) 评论(1) 推荐(0)

水题时的一些问题

摘要: 1. 为什么 int sum=pow(k,2)+k+41; cout<<pow(k,2)+k+41<<endl; cout<<sum<<endl; 输出不一样? (double-int的转换)2. 为什么在比较简单的题目中,用char a[100];scanf("%s",a)会超时?用gets()则不会。eg. hdu 2000 , hdu 2005 阅读全文

posted @ 2012-06-19 11:07 yumao 阅读(132) 评论(2) 推荐(0)

水题时,一些零碎的总结

摘要: 1. 用printf(“%.nf”,….);输出精确n位的小数,结果会自动四舍五入。2. double->int 时,不论double中的小数为什么,int 型都只取double中的整数。3. 求绝对值时: abs()为int型 fabs()为双精度浮点型 cabs()为复数的 labs()为long int型4. 开平方为: sqrt()5. pow()函数返回的为double型,对于结果的转换要注意,容易被强制转换成int,然后就有可能出现问题。6. 用库函数: #include<algorithm> int a[10]; sort(a,a+10);7. 用‘/’时,如果 阅读全文

posted @ 2012-06-19 10:50 yumao 阅读(143) 评论(0) 推荐(0)

导航