|
|
back to boardCommon BoardPlease help me(1209) Posted by kxur 23 Sep 2008 05:09 Where is my mistake? #include<iostream.h> #include<math.h> int top(long int x) { long t ; t = (long)sqrt(8*x -7); t = t*t; if (t != 8*x-7 ) return 0; else return 1; } int main() { long int k; int a[65535]; unsigned short int i; long int n; cin >> n; for( i = 1;i <= n ;i++ ) { cin >>k; if (k != 1) a[i] = top(k); else a[i] = 1; } for (i =1; i<=n; i++) cout << a[i] <<" "; return 0; } |
|
|