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 |
求助:一段程序,Language选择G++总是WA,选C++就AC了,为啥?!#include <stdio.h> double result(double Row, double Column) { if(Row > Column) { double tmp = Row; Row = Column; Column = tmp; } double sum = Row + Column; double Res = (double)1.0; double i; for(i = sum; i >= Column + 1; i --) { Res *= (double)i / (double)Row; Row --; } return Res; } int main() { double x, y; double Ans = 0; while(1) { scanf("%lf %lf", &x, &y); if(x == 0 && y == 0) break; Ans = result(x, y); printf("%.0lf\n", Ans); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator