当前位置:网站首页>【SSL集训DAY2】Sequence【数学】
【SSL集训DAY2】Sequence【数学】
2022-08-09 22:35:00 【VL——MOESR】
思路:
浅推一波我们发现就是把2n分成一个奇数*偶数,我们只需要把2的质因子全部除掉,然后把剩下的分解质因数
c o d e code code
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;
unsigned ll n;
int main() {
cin>>n;
if(n <= 2) {
printf("-1"); return 0; }
n *= 2;
unsigned ll k = 1;
while(n % 2 == 0) {
n /= 2;
k *= 2;
}
if(n == 1) {
printf("-1");
return 0;
}
for(unsigned ll i = 3; i * i <= n; i ++) {
if(n % i == 0) {
cout<<min(i, (k < n ? k : n));
return 0;
}
}
cout<<(k < n ? k : n);
return 0;
}
边栏推荐
猜你喜欢
经济衰退即将来临前CIO控制成本的七种方法
Gartner全球集成系统市场数据追踪,超融合市场增速第一
【面试高频题】可逐步优化的链表高频题
2022-08-09 mysql/stonedb-subquery performance improvement-introduction
探索TiDB Lightning源码来解决发现的bug
《GB5084-2021》PDF下载
Gumbel distribution of discrete choice model
防火墙之系统防护
The latest "Grain Academy Development Tutorial" in 2022: 10 - Front-end payment module
【JZOF】32从上往下打印二叉树
随机推荐
深入理解多线程(第一篇)
2022-08-09 mysql/stonedb-subquery performance improvement-introduction
直播间搭建,按钮左滑出现删除等操作按钮
集合运算样例
Qt 之 QDateEdit 和 QTimeEdit
Gumbel distribution of discrete choice model
70. Stair Climbing Advanced Edition
你的手机曾经被监控过吗?
2020年度SaaS TOP100企业名单
ALV报表总结2022.8.9
Leetcode 98. 验证二叉搜索树
MVC与MVVM模式的区别
友元类和友元函数
技术盛宴!华云数据携六大议题亮相OpenInfra Days China
tiup cluster scale-out
tiup cluster stop
【诗歌】枕上诗书
五分钟商学院(基础---商业篇)
Mysql集群 ShardingSphere
了解什么是架构基本概念和架构本质