Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:跳出条件错了m==0&&n==0In Reply To:大家看一下咯!帮帮忙看哪儿出问题了 和楼下贴的应该一样呀 在线等待!!!! Posted by:yunhong at 2008-07-16 22:13:37 > 我的程序::::: > #include <iostream> > using namespace std; > > int main() > { > double n, m; > while (scanf("%lf%lf", &n, &m)==2, n!=0) > { > double w = n<m ? n:m; > double ans=1.0, i; > for (i=1; i<=w; i+=1) > ans *= ((n+m-i+1)/i); > printf("%.0lf\n", ans); > } > > return 0; > } > ---------------------------- > #include < iostream > > using namespace std; > double com (double n,double m) > { > double i; > double result(1); > if ( n >= m - n ){ n = m-n; } > for ( i = m;i >= m-n+1;i-=1 ) > { > result *= (i / (i - (m - n))); > } > return result; > } > int main() > { > double n,m; > while (1) > { > scanf("%lf%lf",&n,&m); > if ( n==0 && m==0 ){ break; } > printf("%.0lf\n",com (n,m+n)); > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator