热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

UVA11440HelpMr.Tomisu欧拉phi函数

欧拉phi函数的改进版..HelpTomisuTimeLimit: 7000MSMemoryLimit: Unknow


欧拉phi函数的改进版.....


Help Tomisu
Time Limit: 7000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu

Submit Status

Description

技术分享

Problem D
Help Mr. Tomisu
Input: 
Standard Input

Output: Standard Output

After wasting a significant time of his life in problem-setting, Mr. Tomisu is now searching for glory: A glory that will make him famous like Goldbach and rich like Bill Gates :). And he has chosen the field of Number Theory as his prime interest. His creator did not make him very bright and so he needs your help to solve an elementary problem, using which he will begin his pursuit for glory!

Tomisu has come to know that finding out numbers having large prime factors are very important in cryptography. Given two integers N and M, he aims to count the number of integers x between 2 and N! (factorial N), having the property that all prime factors of x are greater than M.

Input

The input file contains at most 500 lines of inputs. Each line contains two integers N (1

Output

For each line of input produce one line of output. This line contains the value T % 100000007 (Modulo 100000007 value of T). Here T is the total number of numbers between 1 and N! (factorial N) which have prime factors greater than M. 

Sample Input                                     Output for Sample Input

100 10

100 20

10000 9000

0 0

43274465

70342844

39714141


Problemsetter: Shahriar Manzoor

Special Thanks: Per Austrin

Source

Root :: AOAPC II: Beginning Algorithm Contests (Second Edition) (Rujia Liu) :: Chapter 10. Maths :: Examples
Root :: Prominent Problemsetters :: Shahriar Manzoor

Root :: AOAPC I: Beginning Algorithm Contests -- Training Guide (Rujia Liu) :: Chapter 2. Mathematics :: Number Theory :: Exercises: Intermediate

Submit Status

技术分享


/* ***********************************************
Author        :CKboss
Created Time  :2015年02月02日 星期一 16时13分33秒
File Name     :UVA11440.cpp
************************************************ */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;

typedef long long int LL;

const LL mod = 100000007LL ;
const int maxn = 10001000;

LL n,m;

bool vis[maxn];
LL phiac[maxn];

/// get prime
void getPRIME()
{
	memset(vis,true,sizeof(vis));
	vis[0]=vis[1]=false;
	for(int i=2;i*i>n>>m)
	{
		if(n==0&&m==0) break;
		LL temp = phiac[m];
		for(int i=m+1;i<=n;i++)
			temp =( temp * i )%mod;
		cout<<(temp-1+mod)%mod<



UVA 11440 Help Mr. Tomisu 欧拉phi函数


推荐阅读
  • selenium 定位方式3css_selector
    关于页面元素定位,可以根据id、class、name属性以及link_text。其中id属性是最理想的定位方式,class与name属性, ... [详细]
  • 根据时间更改网站背景的脚本。热!
    我在网上找到了它,并以自己的方式对其进行了自定义;作者的功劳就在那里。实际上,这是一个用于更改背景颜色的脚本,并且在我看来& ... [详细]
  • The“travellingsalesmanproblem”asksthefollowingquestion:“Givenalistofcitiesandthedistancesb ... [详细]
  • 每次用到v-charts我都一阵头疼,因为明明是相同的功能,但是我好像每次用到的解决方法都不一样??每次都是在api中各种查,各种尝试…直到做了个各种数据图形的需求,决定还是好好整 ... [详细]
  • PyQt 如何创建自定义QWidget
    这篇文章主要介绍了PyQt如何创建自定义QWidget,帮助大家更好的理解和学习使用pyqt,感 ... [详细]
  • UDP协议开发
    UDP是用户数据报协议(UserDatagramProtocol,UDP)的简称,其主要作用是将网络数据流量压缩成数据报形式,提供面向事务的简单信息传送服务。与TCP协议不同,UD ... [详细]
  • 第38天:Python decimal 模块
    by程序员野客在我们开发工作中浮点类型的使用还是比较普遍的,对于一些涉及资金金额的计算更是不能有丝毫误差,Python的decimal模块为浮点型精确计算提供了支持。1简介deci ... [详细]
  • 一、vue介绍Vue.js是一套构建用户界面(UI)的渐进式JavaScript框架,是一个轻量级MVVM(model-view-viewModel&# ... [详细]
  • 一个不错的JDBC连接池教程(带具体例子)
    1.前言数据库应用,在许多软件系统中经常用到,是开发中大型系统不可缺少的辅助。但如果对数据库资源没有很好地管理(如:没有及时回收数据库的游 ... [详细]
  • 媒介这里大部份是本身碰到过的状况,另有一部份自创了偕行的文章,假如人人有碰到别的坑,迎接提出来一同研讨。学问要点1.Meta标签1.制止用户缩放页面,页面强迫让文档的宽度与装备的宽 ... [详细]
  • 日期:2012-4-7来源:GBin1.com在线演示本地下载今天我们介绍一个超棒的创建快速动态互动HTML5可视化图形效果的javascript类库-Envision.j ... [详细]
  • Android JNI学习之Concepts
    2019独角兽企业重金招聘Python工程师标准ConceptsBeforeBeginningThisguideassumesthatyouare:Alreadyfamili ... [详细]
  • 使用ffmpeg进行视频格式转换的简单例子2006-12-1623:12主要参考FFMPEG里面的apiexample.c以及output_example.c编写intmain(in ... [详细]
  • python 解决多张相同的excel取某一些数据合同到一张EXCEL
    这样的表单有几百张把姓名和从事专业类别代码的值取出合并到一张总表里importpandasaspdimportos#第一步读取文件储存在是s列表中pathD:001#文件夹目录fi ... [详细]
  •  jqueryui中dialog和easyui中的dialog很像,但是最近用到的时候全然没有印象,一段时间不用就忘记了,这篇随笔介绍一下这个控件。1.实例官网源代码中给出了一些实例,首先看看实例是什么样子的。 a.默认功能也是最简单的应用,也就是打开一个对话框,代码如下&amp;amp;lt;!doctypehtml&amp;amp;gt;&amp;amp;lt;html ... [详细]
author-avatar
无语噶流浪
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有