题目链接:http://vjudge.net/problem/HDU-1330
这题看起来给人晕乎乎的感觉,实际上废话连篇。不建议写。
1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <iostream> 5 #include <algorithm> 6 #include <string> 7 #include <cstdlib> 8 9 using namespace std; 10 11 int main() 12 { 13 int n; 14 printf("# Cards Overhang "); 15 while(~scanf("%d",&n)) 16 { 17 double sum=0; 18 for(int j=1; j<=n; j++) 19 sum+=1.0/(2*j); 20 printf("%5d%10.3lf ",n,sum); 21 } 22 return 0; 23 }