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 |
show yi xia#include < iostream > using namespace std; bool IsInterOrNot( double a ) { int b; if ( a > 0 ) { b = (int)a; if ((a - b) == 0){ return true; } else { return false; } } else { return false; } } int main() { double n; double k; double d; int t; cin >> n; t = 0; for ( k = 1;;k+=1 ) { d = ( n-k*( k - 1 )/2 ) / k ; if ( d <= 0 ){ break; } if( IsInterOrNot(d) ){ t++; } } cout << t <<endl; return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator