![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
菜鸡一号¥
我很懒,没有加任何个人简介
展开
-
G - Water Testing————2s2=a*2-b+2;皮克定理
G - Water Testing #include <bits/stdc++.h> #include <unordered_map> #include <vector> using namespace std; typedef long long ll; const int maxn = 3e5+1000; typedef pair<ll,ll> PII; map<string,int> ma; int n; PII p[maxn]; inlin原创 2021-06-02 12:37:56 · 119 阅读 · 0 评论 -
K - PhD math Gym - 100814K
K - PhD math Gym - 100814K K - PhD math Gym - 100814K 题干见上面链接,题意大致为给出a,b,n;让我们构造出a/b的前n位数字组成的数字序列组成一个n位数。给出p让我们找出所有子数字序列中能整除p的个数。 思路:这道题目构造出number序列来之后,可以对于p进行每一位的除模运算,然后找到这些位的同余个数对于同余位就是以他们为起止的子序列可以被p整除,然后这样的话找到每一个余数的个数用num*(num-1)/2,可以直接得到这一种余数为起止的个数。 代码原创 2021-03-17 20:07:25 · 131 阅读 · 0 评论 -
G - Gnoll Hypothesis Kattis - gnollhypothesis
题目链接 题目讲解先看另一位博主的讲解吧,我是看的他的博客比这写出来的这道题: 博客链接 求第一个位置时,选中有1的方案及相应的概率: 1-36% 2-25% 3-39% 1-24% 2-25% 4-51% 1-1% 2-25% 5-74% 1-24% 3-64% 4-12% 1-1% 3-64% 5-35% 1-1% 4-76% 5-23% 1号位置的概率期望为(36+24+1+24+1+1)/C(5,3) = 8.7 对于每一个位置i,f[i][j]表示第i个位置被选中,且其上面恰好有j个相邻的位置没有原创 2020-12-14 11:06:55 · 302 阅读 · 0 评论 -
D - A Simple Math Problem HDU - 5974数论—欧几里得
@数论之欧几里得 gcd(an,bn)=ngcd(a,b); 这道题可以用到的是: 条件:a=x+y;b=xy; 结论:gcd(x,y)==gcd(a,b); 题目:D - A Simple Math Problem HDU - 5974 Given two positive integers a and b,find suitable X and Y to meet the conditions:原创 2020-12-09 15:53:46 · 100 阅读 · 0 评论 -
G - Great dinner Gym - 102700G 排队时两人有次序的问题
https://vjudge.net/contest/392956#problem/G G - Great dinner Gym - 102700G UNAL is about to restart classes and the leaders of the algorithms group want to receive all its members with a great dinner in the university campus central dining room. The group原创 2020-09-16 21:07:56 · 233 阅读 · 0 评论 -
快速幂与素数(有素数筛)模板
快速幂:(有mode取模版) long long int mode(long long int a,long long int b, long long int mode) { long long int sum=1; while(b){ if(b&1) { sum=(sum*a)%mode; b--; } b/=2; a=a*a%mod; } re原创 2020-08-15 19:21:39 · 116 阅读 · 0 评论