给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量:       1. 1≤a≤n,1≤b≤m;   2. a×b 是 2016 的倍数.   Input   输入包含不超过 30 组数据.   每组数据包含两个整数 n,m (1≤n,m≤10 9).   Output对于每组数据,输出一个整数表示满足条件的数量.Sample Input 32 63 2016 2016 1000000000 1000000000 Sample Output 1 30576 752314689…
2016湖南省赛----A 2016 (同余定理) Description  给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量: 1. 1≤a≤n,1≤b≤m; 2. a×b 是 2016 的倍数. Input 输入包含不超过 30 组数据. 每组数据包含两个整数 n,m (1≤n,m≤10 9). Output 对于每组数据,输出一个整数表示满足条件的数量. Sample Input 32 63 2016 2016 1000000000 1000000000 Sample…
Bobo has a balanced parenthesis sequence P=p 1 p 2…p n of length n and q questions. The i-th question is whether P remains balanced after p ai and p bi  swapped. Note that questions are individual so that they have no affect on others. Parenthesis se…
Bobo 有一个 n 个点,m 条边的有向无环图(即对于任意点 v,不存在从点 v 开始.点 v 结束的路径). 为了方便,点用 1,2,…,n 编号. 设 count(x,y) 表示点 x 到点 y 不同的路径数量(规定 count(x,x)=0),Bobo 想知道     除以 (10 9+7) 的余数. 其中,a i,b j 是给定的数列.   Input 输入包含不超过 15 组数据. 每组数据的第一行包含两个整数 n,m (1≤n,m≤10 5). 接下来 n 行的第 i 行包含两个整…
题目地址:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1803 Knowledge Point: 同余定理:两个整数a.b,若它们除以整数m所得的余数相等,则称a与b对模m同余或a同余于b模m.记作 a≡b(mod m): 加法运用: (a + b) % m = (a % m + b % m) % m 乘法运用: (a * b) % m = ((a % m) * (b % m)) % m 高精度取模: 一个高精度数对一个数取余,可以把高精…
题目链接 题目大意 给出正整数 n 和 m,统计满足以下条件的正整数对 (a, b) 的数量: 1<=a<=n 1<=b<=m a*b%2016=0 题目思路 我本来以为是容斥啥的,因为我写过一个类似的题目 然而这个2016因子太多,完全不知怎么写 其实很简单如果 \(i*j\;mod\;2016=0\) \((i+k_1*2016)*(j+k_2*2016)\;mod\;2016=0\) 代码 #include<set> #include<map> #in…
Description Bobo has a balanced parenthesis sequence P=p1 p2…pn of length n and q questions. The i-th question is whether P remains balanced after pai and pbi  swapped. Note that questions are individual so that they have no affect on others. Parenth…
题目链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1511 题目大意:在一个8*8的棋盘中,给你一个起点位置和一个终点位置,同时也给你一个陷阱位置,问你从起点绕过陷阱到终点的最短距离.(可以上下左右走还可以斜走) 解题思路:可以直接用搜索,也可以用数学知识来解决,我们之前学过,两点之间直接最短,所以当陷阱不在这条直线上的时候,我们就不用考虑陷阱了,直接是max(abs(x1-y1),abs(x2-y2))最终结果, 但是如果陷阱在两条直线…
愉快的校赛翻皮水! 题解 A 温暖的签到,注意用gets #include <map> #include <set> #include <ctime> #include <cmath> #include <queue> #include <stack> #include <vector> #include <string> #include <cstdio> #include <cstdlib…
传送门:点我 题目很棒,感谢出题验题的大佬们. 细节坑不少,是好事. 还是很菜,继续加油! B: 桃子的生日 时间限制(普通/Java):1000MS/3000MS     内存限制:65536KByte总提交: 344            测试通过: 43 描述 桃子这几天在收集纪念币,总共最多只有N种不同的纪念币,他已经收集了K种不同的纪念币.这不,桃子的生日快到了,他的M个小伙伴们决定送他纪念币,如何送给桃子呢?他们都同意了如下三个规则: 1. 每个人送的纪念币与其他人的都一样多: 2.…