自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

三水的鱼塘♂

极悲 极乐 平和

  • 博客(17)
  • 收藏
  • 关注

原创 浙江财经大学14th校赛

https://pan.baidu.com/s/1rbrR1mRHtXRoun4hNJDHAA代码以后再贴a贪心,只要将每个高度排序,再按照题意来求即可,题目有提示所以很快就想到了b只要知道对于一个k, 1-k 按照题意求得的结果和1+n*k-(n+1)*k范围求得的结果是一样的,那么就很好做了,求一个循环的结果即可,再快速幂一下okcd博弈,只要看x的左边和右边的数字数量相不相等即可ef枚举2个...

2018-03-25 18:58:22 203

原创 codeforces 33

Ahttp://codeforces.com/problemset/problem/33/A找到每一排牙齿的价值的最小值求和,与给出的上限比一下,小就输出 大就输出上限#include<bits/stdc++.h>using namespace std;int main(){ int n,m,s; while(cin>>n>>m>&...

2018-03-25 18:45:23 140

原创 codeforces 34

http://codeforces.com/problemset/problem/34/AA标记1-n个自然数,求min|ai-ai+1|,输出任意一组i和i+1即可#include<bits/stdc++.h>using namespace std;int main(){int n;int a[111];while(cin>>n){for(int i=0;i...

2018-03-25 18:36:19 153

原创 第14届 浙江财经大学 校赛热身赛

https://pan.baidu.com/s/1269eygIK2AxoFoU1_LGdiQ a题注意输出的答案不要出范围即可 建议输出0 n-0b题题目名字叫矩阵快速幂事实上是找循环节。。。。c题状态压缩题,用二进制中的1的数量来表示取哪些木棍,因为是三角形所以只要找到数量为3的二进制数,如果2个这样的数进行按位与操作等于0则表示该2种取法可以同时取到,找到最多的的情况即可。d题公式化简即可e...

2018-03-18 14:22:43 247

原创 2018 3 15省赛训练

http://acm.ocrosoft.com/contest.php?cid=1034NOIP2005普及组第2题 校门外的树题意 给一段数轴,从0-n, 每次操作给一个l和r 删去l和r范围内的整数点,问最终还剩多少整数点解 暴力即可。#include<iostream>#include<algorithm>#include<cstring>#incl...

2018-03-18 14:04:19 194

原创 ZOJ Monthly, March 2018 A B C J H

A Easy Number Game贪心 很容易想到,将数列排序 将前2n个数 掐头去尾的相乘求和#include<iostream>#include<cstring>#include<algorithm>using namespace std;int T;int n,m;int s[100100];int main(){ cin>&...

2018-03-11 17:31:02 322

原创 uva 10214 Trees in a Wood.

与poj 3090相似,只不过数据大了点,于是就预处理2000以内的数的φ,再结合poj 2773中用到的定理即可。#include <cstdio>#include <cmath>#include <map>using namespace std;typedef long long ll;ll p,b,n;void exgcd(ll c,ll d...

2018-03-01 18:46:42 190

原创 po2417 Discrete Logging

给出b n p 求l使得,b^l==n (mod p)学习了一下 BSGS算法。#include <cstdio>#include <cmath>#include <map>using namespace std;typedef long long ll;ll p,b,n;void exgcd(ll c,ll d,ll &x,ll &amp...

2018-03-01 18:46:06 172

原创 51nod 1135 原根

找一个质数p的最小原根就是找到一个最小的a使得a^(p-1)%p=1 ,找出p-1的所有质因数再结合快速幂即可。#include <stdio.h>#include <algorithm>#include <cmath>#include <iostream>#include <string.h>#include <cstr...

2018-03-01 18:45:34 135

原创 hdu 3579 Hello Kiki

同 poj 2891 那道题 也是除数不一定互质的中国剩余定理,但有细节问题,所以做的时候wa了十几发。。#include<stdio.h>#define LL __int64void exgcd(LL a,LL b,LL& d,LL& x,LL& y){ if(!b){d=a;x=1;y=0;} else { e...

2018-03-01 18:45:05 181

原创 poj 2115 C Looooops

同青蛙那道题类似,不过是化简式子的方法不一样,难度就在于化简。欧几里得扩展。#include<iostream>#include<cstdio>#include<algorithm>#include<cmath>using namespace std;long long int ex(long long int a,long long in...

2018-03-01 18:44:35 110

原创 poj 2891 Strange Way to Express Integers

这道题就是解模线性方程组,因为除数都不互质,所以不能用中国剩余定理的方法。#include<iostream>#include<cstdio>#include<algorithm>#include<cmath>using namespace std;long long int ex(long long int a,long long int...

2018-03-01 18:44:05 128

原创 poj 1061 青蛙的约会

这道题是比较经典的欧几里得扩展的题目。通过从题目的意思得到一个等式,再通过一些操作,使之化成ax+by=tgcd(a+b)的式子,求出x再乘上t即可。因为ax+by=gcd 是必有解的。#include<iostream>#include<cstring>#include<cstdio>using namespace std;long long int ...

2018-03-01 18:43:38 116

原创 poj 3090 Visible Lattice Points

在第一象限中,从原点看,能够看到多少个点,只有在整数坐标上有点。看图可以得出,只有2个坐标互质,才能被看到,如果不互质,即gcd!=1,则一定会被挡住。#include<iostream>#include<cstring>#include<cstdio>using namespace std;bool vis[1111][1111]; int an...

2018-03-01 18:43:13 173

原创 poj 2478 Farey Sequence

求n以内中所有互质对数的个数需要用类似于埃筛的方法来找n个数每个数比自己小且互质数的个数  #include<iostream>#include<cstring>#include<cstdio>using namespace std;long long int ans[1000002];int main(){ memset(ans,0,sizeof(...

2018-03-01 18:42:43 145

原创 poj 2773 Happy 2006

求自然数中第k个与n互质的数可以借助规律:如果ab互质,则a+t*b与b也互质,因此可得在1-(b-1)中的互质数的个数与t-(t+b-2)中的互质数的个数相同且一一对应 #include<iostream>#include<cstdio>#include<algorithm>using namespace std;long long int gcd(l...

2018-03-01 18:42:12 117

原创 poj 1248 Primitive Roots

求一个素数不同的原根 就等于φ(φ(n))#include<iostream>#include<cstring>#include<cstdio>using namespace std;int main(){ int n; while(cin>>n) { int a=n-1; int ans=a; for(in...

2018-03-01 18:41:27 128

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除