LightOJ1336 Sigma Function 素因子分解深入理解
来源:互联网 发布:tech域名不能备案 编辑:程序博客网 时间:2024/05/19 01:58
- 只有奇数乘奇数才是奇数,而如果使式子为奇数,只能是2的所有次数或者其他素数的偶数次。
- 素数的次数的任意组合小于等于n的个数有n个,因为每一个数都可以素因子分解成不同的组合。
- 所以奇数有两类,a^2 <= n,或者2是奇数次,2*a^2 <= n,而a就是符合情况的所有组合。
题目链接:http://acm.hust.edu.cn/vjudge/problem/27044
#include<cstdio>#include<iostream>#include<sstream>#include<cstdlib>#include<cmath>#include<cctype>#include<string>#include<cstring>#include<algorithm>#include<stack>#include<queue>#include<set>#include<map>#include<ctime>#include<vector>#include<fstream>#include<list>using namespace std;#define ms(s) memset(s,0,sizeof(s))typedef unsigned long long ULL;typedef long long LL;const int INF = 0x3fffffff;LL n,ans;int main(){// freopen("F:\\input.txt","r",stdin);// freopen("F:\\output.txt","w",stdout);// ios::sync_with_stdio(false); int t; scanf("%d",&t); for(int cas = 1; cas <= t; ++cas){ scanf("%lld",&n); ans = n - (LL)sqrt(n) - (LL)sqrt(n/2); printf("Case %d: %lld\n",cas,ans); } return 0;}
1 0
- LightOJ1336 Sigma Function 素因子分解深入理解
- Lightoj1336——Sigma Function(因子和)
- 20160317 Uva11395 Sigma Function(素因子分解+各种公式+筛数)
- Sigma Function (因子和)
- LightOJ1336 Sigma Function(约数和为奇数的个数)
- LightOJ1336 Sigma Function(约数和为奇数的个数)
- 【lightoj1336】素数分解
- Light OJ 1336 Sigma Function(因子和)
- Sigma Function
- Sigma Function
- Sigma Function
- Sigma Function
- 分解素因子
- CF109D分解素因子
- n! 素因子分解
- 分解素因子(数论)
- 分解素因子(数论)
- FZU_1075_分解素因子
- [PAT] B1005
- minix 文件系统学习.
- ubuntu 下面 redis 安装和配置
- POJ 3468 Splay 做法
- 学习日记20160825
- LightOJ1336 Sigma Function 素因子分解深入理解
- php 面向对象
- eclipse 如何安装freemaker ftl 插件
- Jackson将json字符串转换成泛型List/map
- js实现京东购物放大镜和选项卡效果
- 电商运营到底做什么?你所不知道的电商运营工作
- 题目总结
- 数据结构之二叉树:先中后序遍历(递归)
- spingboot 定时任务