发表时间:2015-05-27来源:网络
The Little Elephant loves the LCM (least common multiple) operation of a non-empty set of positive integers. The result of the LCM operation of k positive integers x1,?x2,?...,?xk is the minimum positive integer that is divisible by each of numbers xi.
Let's assume that there is a sequence of integers b1,?b2,?...,?bn. Let's denote their LCMs as lcm(b1,?b2,?...,?bn) and the maximum of them as max(b1,?b2,?...,?bn). The Little Elephant considers a sequence b good, if lcm(b1,?b2,?...,?bn)?=?max(b1,?b2,?...,?bn).
The Little Elephant has a sequence of integers a1,?a2,?...,?an. Help him find the number of good sequences of integers b1,?b2,?...,?bn, such that for all i (1?≤?i?≤?n) the following condition fulfills: 1?≤?bi?≤?ai. As the answer can be rather large, print the remainder from dividing it by 1000000007 (109?+?7).
InputThe first line contains a single positive integer n (1?≤?n?≤?105) ― the number of integers in the sequence a. The second line contains nspace-separated integers a1,?a2,?...,?an (1?≤?ai?≤?105) ― sequence a.
OutputIn the single line print a single integer ― the answer to the problem modulo 1000000007 (109?+?7).
Sample test(s)41 4 3 2output
15input
26 3output
13
题意:
给你一个a序列,找出一个b序列,1?≤?bi?≤?ai,使得max(bi)=lcm(bi),问这样的bi序列有多少个。
思路:
先对a排序,枚举i=max(bi),对i因式分解,那么大于等于i的部分很好处理,直接pow_mod()相减,小于i的部分就任意取一个约束就够了。
代码:
#include#include #include #include #include #include#define INF 0x3f3f3f3f#define maxn 100005#define mod 1000000007typedef long long ll;using namespace std;int n;int a[maxn];ll pow_mod(ll x,ll n){ ll res = 1; while(n) { if(n&1) res = res * x %mod; x = x * x %mod; n >>= 1; } return res;}void solve(){ int i,j; ll ans=0,res; sort(a+1,a+n+1); for(i=1;ifac; for(j=1;j*j
CI框架连接数据库配置操作以及多数据库操作
asp 简单读取数据表并列出来 ASP如何快速从数据库读取大量数据
C语言关键字及其解释介绍 C语言32个关键字详解
C语言中sizeof是什么意思 c语言里sizeof怎样用法详解
PHP中的魔术方法 :__construct, __destruct , __call, __callStatic,__get, __set, __isset, __unset , __sleep,
将视频设置为Android手机开机动画的教程
PHP中的(++i)前缀自增 和 (i++)后缀自增
常用dos命令及语法
PHP中include和require区别之我见
最简单的asp登陆界面代码 asp登陆界面源代码详细介绍
计支宝app下载v3.1.29 安卓版
142.27MB |商务办公
小小优酷最新版下载v5.4.6 安卓官方版
68.11MB |影音播放
艺图语app下载v3.3.4 安卓免费版
34.33MB |系统工具
爱鸽者手机版下载v3.2.9 安卓版
243.57MB |商务办公
一品威客网接单app(一品众包)下载v2.7.1 安卓最新版
55.01MB |商务办公
诸葛找房网官方版下载v4.8.1.1 安卓最新版
66.6MB |生活服务
皓盘云建最新版下载v9.0 安卓版
53.38MB |商务办公
ris云客移动销售系统最新版下载v1.1.25 安卓手机版
42.71M |商务办公
2022-03-17
2014-09-05
2022-03-20
2022-03-24
2014-09-05
2015-07-05
2014-09-05
2014-09-05
2014-09-05
2022-03-21
葫芦侠三楼最新破解版下载v4.4.0.6 安卓版
其它手游葫芦侠7楼破解版免费下载v4.4.0.6安卓最新版
其它手游葫芦侠八楼免费版下载v4.4.0.6安卓版
其它手游葫芦侠3楼破解版免费下载v4.4.0.6安卓手机版
其它手游像素漫斗抱歉,“八神庵”是特指游戏角色的专有名词,不存在符合要求的常用同义词近义词。下载v1.00安卓版
其它手游葫芦侠4楼破解版游戏修改器下载v4.4.0.6安卓免费版
其它手游末日餐厅安卓版下载v1.35安卓版
其它手游葫芦侠十楼免费破解版下载v4.4.0.6安卓版
其它手游葫芦侠8楼最新破解版下载v4.4.0.6安卓版
其它手游