Odd Divisor(大數判斷是否有奇數因數)

2021-10-17 18:22:25 字數 1551 閱讀 2457

you are given an integer n. check if n has an odd divisor, greater than one (does there exist such a number x (x>1) that n is divisible by x and x is odd).

for example, if n=6, then there is x=3. if n=4, then such a number does not exist.

input

the first line contains one integer t (1≤t≤104) — the number of test cases. then t test cases follow.

each test case contains one integer n (2≤n≤1014).

please note, that the input for some test cases won』t fit into 32-bit integer type, so you should use at least 64-bit integer type in your programming language.

output

for each test case, output on a separate line:

「yes」 if n has an odd divisor, greater than one;

「no」 otherwise.

you can output 「yes」 and 「no」 in any case (for example, the strings yes, yes, yes and yes will be recognized as positive).

example input62

345998244353

1099511627776

output

noyes

noyes

yesno

暴力肯定會tle,所以就要找規律,首先看一下什麼樣的數字一定會有大於1的奇數因數,很明顯所有奇數它本身就是乙個奇數因數,所以只看偶數就行了,我們不妨看一下什麼樣的偶數沒有奇數因數,從2開始列舉發現所有2^n(n是正整數)都沒有奇數因數,仔細想想也想得通,那麼剩下的偶數就都有奇數因數了(好像推不出來,但是歸納一下好像是這麼樣= =)

#include#include#includeusing namespace std;

typedef long long ll;

ll dat[70];

int main()

ll t,n,mi;

bool check;

cin>>t;

for(int i=1;i<=t;++i)

}if(check) cout<<"yes"

return 0;

}

判斷是POST GET請求 判斷是AJAX請求

1.判斷是post get請求 這個大家都知道了,就是 server request method 返回使用者的請求方式 i.e.get head post put eg 2.判斷是ajax請求 框架中頻繁用到 server http x requested with 來判斷是否ajax提交.其實 ...

大資料 什麼是大資料

1.什麼是資料 資料是事實或觀察的結果,是對客觀事物的邏輯歸納,是用於表示客觀事物的未加工的原始材料。資料經過加工之後就成為資訊。2.大資料的定義 麥肯錫給出的大資料定義是 大資料是指大小超過常規的資料庫工具獲取 儲存 管理和分析能力的資料集。但它同時強調,並不是說一定要超過特定的tb值的資料才能是...

大資料 什麼是大資料?

海量的資料 tb pb zb。高增長率 資料的形成速度 使用爬蟲 多樣化 資料是結構化 非結構化 半結構化。電商行業 電商行業是最早利用大資料進行精準營銷,它根據客戶的消費習慣提前生產資料 物流管理等,有利於精細社會大生產。由於電商的資料較為集中,資料量足夠大,資料種類較多,因此未來電商資料應用將會...