Codeforces.697(div3) A. Odd Divisor
本文最后更新于 854 天前,其中的信息可能已经有所发展或是发生改变。

A. Odd Divisor

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

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

The first line contains one integer tt (1≤t≤1041≤t≤104) — the number of test cases. Then tt test cases follow.

Each test case contains one integer nn (2≤n≤10142≤n≤1014).

Please note, that the input for some test cases won’t fit into 3232-bit integer type, so you should use at least 6464-bit integer type in your programming language.Output

For each test case, output on a separate line:

  • “YES” if nn 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

input

6
2
3
4
5
998244353
1099511627776

output

NO
YES
NO
YES
YES
NO

我的题解

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n;
	cin>>n;
	while(n--)
	{
		long long a;
		cin>>a;
		while(a%2==0)
		{
			a/=2;
		}
		if(a!=1)	cout<<"YES"<<endl;
		else	cout<<"NO"<<endl;
	}
	return 0;
}
转载请注明出处!本文链接: https://battlehawk233.cn/post/37.html



暂无评论

发送评论编辑评论

|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇