HDU 5750 Dertouzos
来源:互联网 发布:a4不干胶打印软件 编辑:程序博客网 时间:2024/05/17 23:22
题意:
个人感想:
这比较好做了,主要是枚举素数,不过这道题,我感觉不太好..好容易卡时间哦..我当时都想出来结果就被卡了,有一个问题是就 x*d< n 只要x 和d 都不能拆分质因素使另一个数变得更大就行了,题解说得好清楚了..
分析:数学
/* Author:GavinjouElephant * Title: * Number: * main meanning: * * * *///#define OUT#include <iostream>using namespace std;#include <cstdio>#include <cmath>#include <cstring>#include <algorithm>#include <sstream>#include <cctype>#include <vector>#include <set>#include <cstdlib>#include <map>#include <queue>//#include<initializer_list>//#include <windows.h>//#include <fstream>//#include <conio.h>#define MaxN 0x7fffffff#define MinN -0x7fffffff#define Clear(x) memset(x,0,sizeof(x))const int INF=0x3f3f3f3f;const int maxn=1e7+10;typedef long long ll;int top;bool Is_Prime[maxn];int prime[maxn];ll n,d;ll N;void init(){ top=0; memset(Is_Prime,false,sizeof(Is_Prime)); Is_Prime[0]=true; Is_Prime[1]=true; for(int i=2;i<maxn;i++) { if(!Is_Prime[i]) { prime[top++]=i; } for(int j=0;j<top;j++) { if((i*prime[j])>=maxn)break; Is_Prime[i*prime[j]]=true; if(i%prime[j]==0)break; } }}int main(){#ifdef OUT freopen("coco.txt","r",stdin); freopen("lala.txt","w",stdout);#endif init(); int T; scanf("%d",&T); while(T--) { ll ans=0; scanf("%I64d%I64d",&n,&d); for(int j=0;j<top;j++) { if(prime[j]>((n-1)/d))break; ans++; if(!(d%prime[j]))break; } printf("%I64d\n",ans); } return 0;}
1 0
- HDU 5750 Dertouzos
- hdu 5750 Dertouzos
- HDU-5750 Dertouzos
- HDU 5750 Dertouzos
- HDU 5750 Dertouzos
- Hdu 5750 Dertouzos
- HDU 5750 Dertouzos
- HDU 5750 Dertouzos
- HDU 5750 Dertouzos(数论)
- HDU 5750 Dertouzos (数论)
- HDU 5750 Dertouzos
- hdu-5750-Dertouzos-数学
- HDU 5750 Dertouzos
- HDU 5750 Dertouzos(素数)
- HDU 5750 Dertouzos(数论)
- hdu 5750 Dertouzos (素数+数学)
- hdu 5750 Dertouzos(数论)
- hdu 5750——Dertouzos(简单)
- 最强日期正则表达式
- 【Effective C++读书笔记】篇十(条款25)
- ERROR org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler - Exception
- Mac charles 配置ssl
- 4、字符串
- HDU 5750 Dertouzos
- 重学搜索yi.3:迷宫的最短路径--bfs
- hdu 统计问题 (递推)
- Linux makefile 教程 非常详细,且易懂
- CodeForce 27E
- LeetCode:Single Number系列
- Virtual Box 安装
- Linux中各种设备及设备号
- 【嵌入式学习日记】2016年7月24日