poj 1607(水题)
作者:互联网
#include<iostream> using namespace std; int main(){ int cnt,i,data[105]; double ans[105]; cnt = 0; while(scanf("%d",&data[cnt])==1){ ans[cnt] = 0; for(i=1;i<=data[cnt];i++){ ans[cnt] += 0.5/i; } cnt++; } printf("Cards Overhang\n"); for(i=0;i<cnt;i++){ printf("%5d %.3lf\n",data[i],ans[i]); } return 0; }
标签:std,cnt,水题,int,1607,poj,ans,data,105 来源: https://www.cnblogs.com/stevenzrx/p/15552660.html