数论
文章平均质量分 65
_leon1999
qaq
展开
-
P2822 组合数问题(矩阵前缀和)
问题 H: 组合数问题I时间限制: 1 Sec 内存限制: 512 MB提交: 181 解决: 49[提交][状态][讨论版][命题人:admin]题目描述 组合数表示的是从n个物品中选出m个物品的方案数。举个例子,从(1,2,3)三个物品中选择两个物品可以有(1, 2), (1, 3), (2, 3)这三种选择方法。根据组合数的定义,我们可以给出计算组合数 的一般公式: ...原创 2018-04-10 17:02:26 · 200 阅读 · 0 评论 -
2019 Multi-University Training Contest 8 Acesrc and Good Numbers (计数+方法)
Acesrc and Good NumbersTime Limit: 2000/2000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 563Accepted Submission(s): 290Problem DescriptionAcesrc is...原创 2019-09-16 10:42:18 · 200 阅读 · 0 评论 -
当我有些理解线性筛
最近在学习数论,重新看了莫比乌斯反演,欧拉函数等。。。发现线性筛有很大的用处。。。。1.筛素数#include<bits/stdc++.h>using namespace std;const int N = 1e5+5;bool not_prime[N];int prime[N];int tot;void get_prime(int n){ for...原创 2019-06-18 11:44:44 · 131 阅读 · 0 评论 -
欧拉函数学习
学习欧拉函数首先要理解线性筛。普通的筛法就不记录了。 bool number[maxn+5];void isprime(){ int prime[maxn+5]; int i,j,c=0; memset(number,true,sizeof(number)); for(i=2;i<=maxn;i++) { if(numbe...原创 2019-06-16 17:44:58 · 183 阅读 · 0 评论 -
蔡勒公式
解决的问题:给出年月日计算出是星期几。图片来自百度百科。原创 2018-12-04 13:23:37 · 548 阅读 · 0 评论 -
The 2018 ACM-ICPC Asia Qingdao Regional Contest
Function and FunctionTime Limit: 1 Second Memory Limit: 65536 KBIf we define , do you know what function means?Actually, calculates the total number of enclosed areas produced by each dig...原创 2018-11-10 19:35:39 · 120 阅读 · 0 评论 -
ICPC shenyang 2015 BEST SOLVER (数论)
BEST SOLVER时间限制: 1 Sec 内存限制: 128 MB提交: 33 解决: 16[提交] [状态] [讨论版] [命题人:admin]题目描述The so-called best problem solver can easily solve this problem, with his/her childhood sweetheart.It is know...原创 2018-10-09 21:56:17 · 133 阅读 · 0 评论 -
hdu 2256 4565 (矩阵快速幂 递推)
Problem of PrecisionTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1957 Accepted Submission(s): 1206 Problem DescriptionInput...原创 2018-10-09 20:01:27 · 136 阅读 · 0 评论 -
hdu 6395 (分块矩阵快速幂)
http://acm.hdu.edu.cn/showproblem.php?pid=6395解题思路:p/n在一些区间内是相同的,找出这些区间用矩阵快速幂即可,区间右端点可以二分找也可以//int j=P/i==0?n:min(n,P/(P/i));这样找,目前还不知道为什么可以这样0(1)的找。#include<iostream>#include<cstdio&...原创 2018-08-24 20:10:12 · 254 阅读 · 0 评论 -
ICPC2017 Urumqi 容斥原理
Sum of the Line时间限制: 1 Sec 内存限制: 128 MB提交: 211 解决: 61[提交] [状态] [讨论版] [命题人:admin]题目描述Consider a triangle of integers, denoted by T. The value at (r, c) is denoted by Tr,c , where 1 ≤ r and 1...原创 2018-08-23 10:15:34 · 152 阅读 · 0 评论 -
hdu 4135 Co-prime (容斥原理)
Co-prime HDU - 4135 Given a number N, you are asked to count the number of integers between A and B inclusive which are relatively prime to N. Two integers are said to be co-prime or relatively p...原创 2018-08-23 10:08:16 · 323 阅读 · 0 评论 -
upc 训练赛第六场 游戏(组合数)
问题 B: 游戏时间限制: 1 Sec 内存限制: 512 MB提交: 180 解决: 48[提交] [状态] [讨论版] [命题人:admin]题目描述九条可怜是一个热爱游戏的女孩子,她经常在网上和一些网友们玩一款叫做《僵尸危机》游戏。在这款游戏中,玩家们会需要在成为僵尸之前与黑恶势力斗智斗勇,逃离被病毒感染的小岛。但是黑恶势力不会让玩家轻易得逞,他会把一些玩家抓走改造成僵...原创 2018-07-31 10:46:24 · 240 阅读 · 1 评论 -
hdu 2089 不要62 数位dp
不要62 HDU - 2089 #include<iostream>#include<cstdio>#include<cstring>#define LL long longusing namespace std;LL dp[10][10];int a[10];void init(){ dp[0][0]=1;//dp[i][j]代表i位数...原创 2018-06-26 11:04:29 · 152 阅读 · 0 评论 -
poj 2142 (解不定方程)
The Balance POJ - 2142 考虑到 ax+by=d假设解为正时代表在天平左边,解为负时代表在天平右边通过拓展欧几里得解出一组解然后通过不断枚举找出最优解我直接-50000 到50000 枚举了....#include<iostream>#include<cstdio>#include<cstring>#include<cmath&g...原创 2018-05-24 16:24:18 · 313 阅读 · 0 评论 -
拓展欧几里得求逆元
A/B HDU - 1576 乘法逆元:对于缩系中的元素,每个数a均有唯一的与之对应的乘法逆元x,使得ax≡1(mod n)一个数有逆元的充分必要条件是gcd(a,n)=1,此时逆元唯一存在 逆元的含义:模n意义下,1个数a如果有逆元x,那么除以a相当于乘以x。#include<iostream>#include<cstdio>using namespace std;...原创 2018-05-23 20:59:18 · 446 阅读 · 0 评论 -
拓展欧几里得
模板#include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>using namespace std;#define LL long longLL exgcd(LL a,LL b,LL &x,LL &am...原创 2018-05-23 15:56:46 · 97 阅读 · 0 评论 -
hdu 5656 CA Loves GCD
参考题解:https://blog.csdn.net/xym_CSDN/article/details/51052074CA is a fine comrade who loves the party and people; inevitably she loves GCD (greatest common divisor) too. Now, there are NN different num...原创 2018-05-06 11:47:30 · 129 阅读 · 0 评论 -
广东工业大学月赛1256
Problem E: 单身狗Time Limit: 1 Sec Memory Limit: 128 MBDescription给定N,统计[1,N]中所有数字1出现的次数。Input第一行为一个整数T,表示测试用例的数量。每个测试用例包含一个数字N。数据范围:T<=100,1<=N<=1e9。Output对于每组测试用例,输出[1,N]中所有数字1出现的次数。Sample In...原创 2018-04-06 20:32:16 · 111 阅读 · 0 评论