Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Timus 1209
- #include <cmath>
- #include <iostream>
- using namespace std;
- bool Odin (long long n)
- {
- double intPart;
- double para = (1 + sqrt ( 8 * n -7)) /2;
- double fractPart = modf(para, &intPart);
- if (fractPart == 0.0)
- return true;
- else
- return false;
- }
- int main()
- {
- long long val;
- long long num, i = 0;
- cin >> num;
- while (i < num)
- {
- cin >> val;
- if (Odin (val))
- cout << "1 ";
- else
- cout << "0 ";
- i++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement