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 |
怎么会出现output limit exceed呢?不是遇-1就结束吗?我的源代码如下: #include <iostream.h> long fac[10] = { 1,1,2,6,24,120 ,720,5040,40320,362880}; int main() { long n; int i; cin>>n; while ( n != -1 ) { i = 9; while ( n >= 0 && i >= 0 ) { if ( fac[i] <= n ) n = n - fac[i]; i --; } if ( n == 0 ) cout << "YES"; else cout << "NO"; cout << endl; cin>>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