HDU 多校1.4
Division Game
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 0 Accepted Submission(s): 0
piles of stones in a circle, numbered from 0
to k−1
, where the number of the stones in each pile is n
initially. You can do some round operations, where the initial round is numbered as the 1
-st round.
The operation of the i
-th round is to modify the pile of stones numbered (i−1)modk
. In each round, you should remove from this pile some stones (at least one stone), satisfying that the number of stones in this pile before this operation is a multiple of the number of stones in this pile after operation, which means that you ought to remain at least one stone in this pile.
The game is ended if there exists at least one pile containing only one stone. Given two positive integers n
and k
, your task is to calculate for each pile the number of the possible operation plans that it is the last operated pile before the game is ended.
The integer n
may be very large, so the prime-factor decomposition of n
will be given, in other words, if n=∏mi=1peii
, then the integers m
and (pi,ei)
(1≤i≤m)
will be given, but the integer n
will not.
The answer may be very large, so you only need to give the value of the answer modulo 985661441
.
For each test case:
The first line contains two positive integers m
and k
, satisfying that 1≤m,k≤10
.
In next m
lines, the i
-th line contains two positive integers pi
and ei
, satisfying that 2≤pi≤109,
ei≥1,
∑mi=1ei≤105
.
It is guaranteed that p1,p2,⋯,pm
are distinct.
About 200
test cases in total, where no more than 5
cases satisfy ∑mi=1ei≥104
.
: y0
y1
⋯
yk−1
" in one line (without quotes), where xindicates the case number starting from 1
and yi
(0≤i<k)
denotes the number of the possible operation plans modulo 985661441
for the pile numbered i
of corresponding case.
2 2
2 1
3 1
5 1
1 2
2 3
2 2
2 4
5 4
Case #2: 3
Case #3: 6 4
Case #4: 1499980 1281085
HDU 多校1.4的更多相关文章
- 2018 HDU多校第四场赛后补题
2018 HDU多校第四场赛后补题 自己学校出的毒瘤场..吃枣药丸 hdu中的题号是6332 - 6343. K. Expression in Memories 题意: 判断一个简化版的算术表达式是否 ...
- 2018 HDU多校第三场赛后补题
2018 HDU多校第三场赛后补题 从易到难来写吧,其中题意有些直接摘了Claris的,数据范围是就不标了. 如果需要可以去hdu题库里找.题号是6319 - 6331. L. Visual Cube ...
- 2015 HDU 多校联赛 5363 Key Set
2015 HDU 多校联赛 5363 Key Set 题目: http://acm.hdu.edu.cn/showproblem.php? pid=5363 依据前面给出的样例,得出求解公式 fn = ...
- 2015 HDU 多校联赛 5317 RGCDQ 筛法求解
2015 HDU 多校联赛 5317 RGCDQ 筛法求解 题目 http://acm.hdu.edu.cn/showproblem.php? pid=5317 本题的数据量非常大,測试样例多.数据 ...
- [HDU多校]Ridiculous Netizens
[HDU多校]Ridiculous Netizens 点分治 分成两个部分:对某一点P,连通块经过P或不经过P. 经过P采用树形依赖背包 不经过P的部分递归计算 树型依赖背包 v点必须由其父亲u点转移 ...
- 【杂题总汇】HDU多校赛第十场 Videos
[HDU2018多校赛第十场]Videos 最后一场比赛也结束了…… +HDU传送门+ ◇ 题目 <简要翻译> 有n个人以及m部电影,每个人都有一个快乐值.每场电影都有它的开始.结束时间和 ...
- hdu多校1002 Balanced Sequence
Balanced Sequence Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s) ...
- HDU多校(Distinct Values)
Problem Description Chiaki has an array of n positive integers. You are told some facts about the ar ...
- hdu多校6
这个场要恶心死我了.. 1001 积分题,不要四舍五入 //#pragma comment(linker, "/stack:200000000") //#pragma GCC op ...
- hdu 多校第一场
1001 思路:打表可以发现只有3|n 和 4|n 的情况有解,判一下就好啦. #include<bits/stdc++.h> #define LL long long #define f ...
随机推荐
- JS格式化 /Date(xxxxxx)/的日期类型
//用来转换/Date(xxxxxx)/类型的JSON日期为要求的日期格式字符串String.prototype._formatJsonDate = function (format) { var s ...
- [洛谷P1887]乘积最大3
题目大意:请你找出$m$个和为$n$的正整数,他们的乘积要尽可能的大.输出字典序最小的方案 题解:对于一些数,若它们的和相同,那么越接近它们的乘积越大. 卡点:无 C++ Code: #include ...
- JavaScript(二):对象、注释、事件!
对象 JavaScript的一个重要功能就是面向对象的功能,通过基于对象的程序设计,可以用更直观.模块化和可重复使用的方式进行程序开发. 一组包含数据的属性和对属性中包含数据进行操作的方法,称为对象. ...
- oracle大数据匹配处理C#
忙碌了几天写出来的oracle存储过程在作业中执行. 写的oracle存储过程如果有什么不好的地方大家指点指点. oracle存储过程其中使用到游标嵌套.if.if嵌套.数据插入表.select插入表 ...
- mybatis学习(七)——resultType解析
resultType是sql映射文件中定义返回值类型,返回值有基本类型,对象类型,List类型,Map类型等.现总结一下再解释 总结: resultType: 1.基本类型 :resultType= ...
- 自定义toolbar教程
1.写toolbar的布局文件 ,toolbar.xml <?xml version="1.0" encoding="utf-8"?> <Re ...
- Python爬虫学习笔记之爬取新浪微博
import requests from urllib.parse import urlencode from pyquery import PyQuery as pq from pymongo im ...
- [POJ1286&POJ2154&POJ2409]Polya定理
Polya定理 L=1/|G|*(m^c(p1)+m^c(p2)+...+m^c(pk)) G为置换群大小 m为颜色数量 c(pi)表示第i个置换的循环节数 如置换(123)(45)(6)其循环节数为 ...
- 【BZOJ】1799: [Ahoi2009]self 同类分布
[题意]给出a,b,求出[a,b]中各位数字之和能整除原数的数的个数.1 ≤ a ≤ b ≤ 10^18 [算法]数位DP [题解] 感觉这种方法很暴力啊. 枚举数位和1~162(不能枚举0,不然会模 ...
- keras_实现cnn_手写数字识别
# conding:utf-8 import os os.environ[' import numpy as np from keras.models import Sequential from k ...