HDU 2608 : 0 or 1 ( 数论)

时间:2019-11-11
本文章向大家介绍HDU 2608 : 0 or 1 ( 数论),主要包括HDU 2608 : 0 or 1 ( 数论)使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

Solving problem is a interesting thing. DragonLee like to slove different problembecause he think it is a way let him more intelligent. But as we knowDragonLee is weak in math. When he come up against a difficult math problem he always try to get a hand. 

Now the problem is coming! Let we define T(n) as the sum of all numbers which are positive integers can divied n. and S(n) = T(1) + T(2) + T(3)+...+T(n).

Input

The first line of the input contains an integer T which means the number of test cases. Then T lines follow each line consists of only one positive integers n. You may assume the integer will not exceed 2^31.

Output

For each test case you should output one lines of one integer S(n) %2. So you may see the answer is always 0 or 1 .

Sample Input

copy
3 1 2 3

Sample Output

copy
1 0 0

HINT

S(3) = T(1) + T(2) +T(3) = 1 + (1+2) + (1+3) = 8

S(3) % 2 = 0 

 

#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cstdio>
#include <set>
#include <math.h>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <ctime>
#define ind 0x3f3f3f3f
#define ll long long
using namespace std;
const int mxn = 1e6;
int n,m,k,ans,cnt,cs,a[mxn];
int main()
{
    ll col;
    cin>>n;
    while(n--)
    {
        cin>>col;
        cout<< ( (int)sqrt(col*1.0)%2 + (int)sqrt(col/2.0)%2 )%2<<endl;
    }
    return 0;
}

原文地址:https://www.cnblogs.com/Shallow-dream/p/11837771.html