当前位置:网站首页>【CF#697 (Div. 3)】 A - Odd Divisor
【CF#697 (Div. 3)】 A - Odd Divisor
2022-06-11 07:10:00 【percation】
The main idea of the topic , Judge the input number n n n Whether there is Odd factor , If there is, then YES, otherwise NO.
When n n n In an odd number of , accord with YES
That is, just judge n For even when ( Such as 6,12,30 etc. ), Whether there is an odd factor
because ,2 Power square ( To the power of 1 Start , because n>=2), There must be no odd factor
therefore , Take will n n n % 2, If it's worth 0, Will n n n /= 2, Circular judgement n n n%2 Is it 0.
If finally n Result > 1, Then there is an odd factor . conversely , Otherwise .
/* * author: percation * date: 2022.2.27 */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6 + 10;
ll n;
ll t;
int main(){
cin >> t;
while(t--){
cin >> n;
while(n % 2 == 0){
n /= 2;
}
if(n > 1){
cout << "YES" << endl;
}
else{
cout <<"NO" << endl;
}
}
return 0;
}
边栏推荐
猜你喜欢

品牌定位个性六种形态及结论的重大意义

WPF 数据绑定(四)

Listen to the left width of the browser to calculate the distance
![[deploy private warehouse based on harbor] 4 push image to harbor](/img/af/8e28b229d94f3e6eab02308b69dc74.jpg)
[deploy private warehouse based on harbor] 4 push image to harbor

Nodejs database (Part 2)

1、 Sqlserver2008 installation (with password), database creation, C form project test

Object. Specific implementation and difference between create() and new

Saltstack deployment LNMP

【LeetCode】-- 17.电话号码的字母组合

Latex various arrows / arrows with text labels / variable length arrows
随机推荐
[advanced concurrency] - thread pool summary
Dynamically change the direction of this
421. maximum XOR value of two numbers in the array
Cross-Modal Pattern-Propagation for RGB-T Tracking
Library management system 2- demand analysis
【LeetCode】-- 17.电话号码的字母组合
Graph Attention Tracking
Summary of string processing skills III
并发工具类
Listen to the left width of the browser to calculate the distance
Senior openstacker - Bloomberg, vexxhost upgraded to the Gold member of openinfra Foundation
【迅为干货】龙芯2k1000开发板opencv 测试
webserver
Leetcode-141. Linked List Cycle
Records how cookies are carried in cross domain requests
顶流编辑器 Atom,将于 12 月 15 日退出历史舞台
es5和es6的学习小记
Server parameter adjustment record
Drawing with qpainter
213. house raiding II