
其他数论
文章平均质量分 66
Mr_Treeeee
这个作者很懒,什么都没留下…
展开
-
HDU 2973 YAPTCHA(威尔逊定理)
YAPTCHATime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 930 Accepted Submission(s): 491Problem DescriptionThe math department原创 2017-07-18 22:06:42 · 376 阅读 · 0 评论 -
ZOJ 4029 - Now Loading!!! (数论 规律)
题目由于n,m比较大,说明时间复杂度最多再乘以log。这里由于log(a[i])最大只有30,那么我们考虑去预处理出a[i]/k的前缀和(k为分母)然后每次对一个读入的p,令分母确定为tmp,那么a[i]的范围应该是[pow(p,tmp-1)+1,pow(p,tmp)],利用二分找出两个位置,然后用一下前缀和即可。#include <iostream>#include <std...原创 2018-05-06 20:39:33 · 393 阅读 · 0 评论 -
山东省第六届省赛 - Square Number(平方数)
题目题意:给你一些数,让你找到相乘是平方数的对数。POINT:先打个质数筛,不然超时。因为平方数=平方数*平方数。一开始我对每一个数枚举出它的平方数因子,找出对应的个数。这样超时。O(n*sqrt(Max)).看了题解:对每个数进行降平方操作,把平方数因子全部除掉。最后得到num数组,C(num[x],2) (x=1,2,3……)就行了。#include <iostream>#inc...原创 2018-05-16 11:30:06 · 240 阅读 · 0 评论 -
山东省第六届省赛 - Cube number (立方数)
题目题意:给你一组数,问你两个数乘起来是立方数的对数。POINT:先降立方操作。除掉立方数。之后得到的数肯定为. x=a1^1*a2^1*a3^2*a4^2……a1,a2,a3都是它的质因数。即 这个数是一些质数的平方或者本身乘起来。所以要找到对应的数和他乘起来刚好为a1^3*a2^3*a3^3*a4^3.而且要快。假设to就是我们要找的数。遍历for(int i=1;pri[i]*pri[i]...原创 2018-05-16 11:40:11 · 769 阅读 · 2 评论 -
Educational Codeforces Round 47 - E. Intercity Travelling
题目题意:司机不休息的话,走1公里,消耗a1,再走一公里消耗a2,然后a3、a4。这样消耗下去。有休息站,可以让a数组重新数。问你总消耗的期望*2^(n-1)。 POINT:可以推一下。px为x这个坐标的期望组成。p1=1*a1 (第一个永远是a1)p2=1/2*a1+1/2*a2 (2这个点,有1/2的概率有休息站,那么1/2*a1,有1/2没有,那么从...原创 2018-07-16 20:30:14 · 267 阅读 · 0 评论 -
洛谷 - P1492 猩猩散步
点击打开链接 POINT: 答案为C(n+m,m)或者C(n+m,n)。然后因为完全模拟为超时。JAVA大数乘法超时。那么先把分母分子全部质因数分解。把答案化为质因数的个数。然后作高精度低乘 #include <iostream>#include <stdio.h>#include <algorithm>#i...原创 2018-07-10 19:50:25 · 312 阅读 · 0 评论 -
洛谷 - P1052 过河
题解 #include <iostream>#include <stdio.h>#include <algorithm>#include <string.h>using namespace std;#define LL long longint dp[20020];int st[20020];int a[222];int ...原创 2018-07-11 09:15:41 · 186 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第一场) - A Monotonic Matrix (定理)
Count the number of n x m matrices A satisfying the following condition modulo (109+7).*Ai,j ∈{0,1,2}forall1≤i≤n,1≤j≤m.*Ai,j ≤Ai+1,j forall1≤i<n,1≤j≤m.*Ai,j ≤Ai,j+1 forall1≤i≤n,1≤j<m.输入描述:...原创 2018-07-20 13:14:32 · 377 阅读 · 0 评论 -
BZOJ 3884 - 上帝与集合的正确用法(欧拉定理)
题解 #include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <vector>using namespace std;#define LL long longconst LL mod = 998244353...原创 2018-07-29 00:10:04 · 347 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第四场) - A Ternary String (欧拉函数降幂)
设前面经过t秒才到这个s[i].那么删这个数(和他的生产物)有这个规律0: t+11: 2*(t+1)2: 3*(2^(t+1)-1)虽然找到了规律,可以用递推的方法求出答案。但是答案一下成为幂,但是一下又要对1e9+7取模。所以只能用欧拉函数降幂做。我们可以利用欧拉函数phi()的性质。对于a,c互质成立。 对于a,c不互质的情况。用广义欧拉定理:对于...原创 2018-07-29 00:25:56 · 327 阅读 · 0 评论 -
HDU 5451- Best Solver (数论)
http://acm.hdu.edu.cn/showproblem.php?pid=5451 共轭知识:设C(n)=(a+sqrt(b))^n当a^2<b的时候有:C(n+1)=2*a*C(n)-(a*a-b)*C(n-1).C(n)是(a+sqrt(b))^n 向上取整形式。这题是向下取整。减1就行了。有了递推公式,只要求循环节就行了。因为mod很小。 ...原创 2018-07-31 22:13:14 · 243 阅读 · 0 评论 -
EOJ Monthly 2018.10 - C 痛苦的 01 矩阵 (数学推导)
https://acm.ecnu.edu.cn/contest/113/problem/C/ POINT:用 表示第i行有多少个 0,用 表示第 j 列有多少个 0,bij 表示第 i 行第 j 列是否为 0。则 cost(i,j)=+−。设C为全矩阵0的个数。同理求和2cb=2c^2。所以得每次修改操作至多只会影响一个 ci 和一个 ri,将...原创 2018-10-03 21:53:52 · 392 阅读 · 0 评论 -
Codeforces Round #512 (Div. 2) - D. Vasya and Triangle (皮克公式)
http://codeforces.com/contest/1058/problem/D 题意:在x [0,n]. y[0,m]的坐标系中,找到一个格点三角形(三角形的顶点全在格点上),他的面积是n*m/k. POINT:皮克定理是指一个计算点阵中顶点在格点上的多边形面积公式,该公式可以表示为2S=2a+b-2,其中a表示多边形内部的点数,b表示多边形边界上的点数,S表示多...原创 2018-09-27 21:52:04 · 278 阅读 · 0 评论 -
ZOJ Monthly, January 2018 - F The Limit
题意:求分数的极限。POINT:简单的多项式处理掉。然后0/0的时候洛必达上下求导继续。1/0 输出inf。注意分母为1的时候。#include #include #include #include #include #include using namespace std;#define LL long longconst LL maxn =原创 2018-01-25 18:05:03 · 384 阅读 · 0 评论 -
2017年浙工大网络同步赛 - 栗酱的数列 (差分+KMP)
题目描述 栗酱有一个长度为n的数列A,一个长度为m的数列B,现在询问A中有多少个长度为m的连续子序列A',满足(a'1+b1)%k = (a'2+b2)%k = …… = (a'm + bm)%k。输入描述:第一行一个数T,表示有T组数据。对于每组数据,第一行三个整数,n, m, k。第一行输入n个数, a1,a2,…,an, 表示A数列中的数,第二行输入m个数, b1原创 2018-01-23 19:16:48 · 325 阅读 · 0 评论 -
HDU 6063 RXD and math (打表)
RXD and mathTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 110 Accepted Submission(s): 48Problem DescriptionRXD is a good原创 2017-08-01 18:27:50 · 386 阅读 · 0 评论 -
FZU 1669 Right-angled Triangle(解毕达哥拉斯三元组)
Problem 1669 Right-angled TriangleAccept: 94 Submit: 183Time Limit: 1000 mSec Memory Limit : 32768 KB Problem DescriptionA triangle is one of the basic shapes of geometry: a原创 2017-07-19 13:46:57 · 694 阅读 · 0 评论 -
POJ 3233 Matrix Power Series (矩阵快速幂+等比数列二分求和)
Matrix Power SeriesTime Limit: 3000MS Memory Limit: 131072KTotal Submissions: 23205 Accepted: 9669DescriptionGiven a n × n matrix A and a positive integer k, fi原创 2017-07-20 12:09:18 · 434 阅读 · 0 评论 -
HDU 6069 Counting Divisors(求因子)
Counting DivisorsTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 2316 Accepted Submission(s): 833Problem DescriptionIn mat原创 2017-08-04 20:56:56 · 358 阅读 · 0 评论 -
HDU 1452 Happy 2004(约数和定理)
Happy 2004Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1904 Accepted Submission(s): 1394Problem DescriptionConsider a posi原创 2017-08-22 19:35:42 · 350 阅读 · 0 评论 -
NBUOJ 2707 liylho的难题(因子)
2707 liylho的难题 Time Limit : 2000/1000 MS(Java/Others) | Memory Limit :65536/32768 KB(Java/Others) Submits : 28 | Solved : 8 Description Liylho在考试中得了第一名,所以老师让他去向学习委员要奖品。可是在liylho找到学习委员要原创 2017-08-23 16:12:59 · 1696 阅读 · 0 评论 -
2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 - E Half-consecutive Numbers
The numbers 11, 33, 66, 1010, 1515, 2121, 2828, 3636, 4545 and ti=12i(i+1)ti=21i(i+1), are called half-consecutive.For given NN, find the smallest rr which is no smaller than NN such原创 2017-09-17 23:29:28 · 456 阅读 · 0 评论 -
HDU 5974 A Simple Math Problem(GCD LCM)
A Simple Math ProblemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2801 Accepted Submission(s): 874Problem DescriptionGiven原创 2017-09-28 19:02:29 · 326 阅读 · 0 评论 -
HDU 5976 - Detachment (拆数乘法)
DetachmentTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1723 Accepted Submission(s): 481Problem DescriptionIn a highly deve原创 2017-09-28 19:10:15 · 416 阅读 · 0 评论 -
Codeforces Round #439 (Div. 2) - B. The Eternal Immortality(规律)
B. The Eternal Immortalitytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputEven if the world is full of coun原创 2017-10-08 22:47:28 · 535 阅读 · 0 评论 -
HDU 1124 - Factorial (数学)
FactorialTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4387 Accepted Submission(s): 2892Problem DescriptionThe most importa原创 2017-12-07 23:12:23 · 231 阅读 · 0 评论 -
Codeforces Round #451 (Div. 2) - B. Proper Nutrition (扩展欧几里得)
B. Proper Nutritiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya has n burles. One bottle of Ber-Co原创 2017-12-18 22:30:21 · 408 阅读 · 0 评论 -
ZOJ 3753 - Simple Equation (数论)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3753题意:给你A,B,M.找出满足AX + BY = XY的X,Y。条件X>=M,在X+Y最小的前提下 X最小。 POINT:变形得 (X-B)*(Y-A)=A*BAB已知,求x+y最小,就是求x-b+y-a最小。x-b和y-a明显是a...原创 2018-09-27 22:21:05 · 235 阅读 · 0 评论