标签:des style blog color io java strong for 数据
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 41919 Accepted Submission(s):
24512
1 #include<cstdio> 2 int main() 3 { 4 int m; 5 while(scanf("%d",&m)==1) 6 { 7 if(m<1||m>100)return 0; 8 for(int i=1;i<=m;i++)//m 个数 9 { 10 int n; 11 float sum=0; 12 scanf("%d",&n); //依次输入数据 13 if(n<1||n>1000)return 0; 14 for(int j=1;j<=n;j++) 15 { 16 if(j%2)sum=sum+1.0/j; 17 else sum=sum-1.0/j; 18 } 19 printf("%.2f\n",sum); 20 } 21 } 22 return 0; 23 }
标签:des style blog color io java strong for 数据
原文地址:http://www.cnblogs.com/The-courage-that-year/p/3991361.html