自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(22)
  • 收藏
  • 关注

转载 类欧几里得算法

算是知道了扩展欧几里得这个算法了吧。。。。 转载自http://www.cnblogs.com/cyz666/ f的模板 LL f(LL a,LL b,LL c,LL n) { if(a==0) return((b/c)*(n+1)); if(a>=c||b>=c) return f(a%c,b%c,c,n)+(a/c)*n*(n+1)/2+(b/c)*(...

2018-09-05 22:17:15 1195

原创 hdu6447(离散化+线段树+dp)(01背包)

题目: YJJ is a salesman who has traveled through western country. YJJ is always on journey. Either is he at the destination, or on the way to destination. One day, he is going to travel from city A to...

2018-09-04 11:25:21 610

原创 hdu6440(费马小定理构造)

题目: 题目不太好复制:hdu6440 题意: 真的是。。。太难读了。。。。。 意思就是,要你重新定义加法和乘法,使题目要求的等式: (m+n)^p=m^p+n^p 能够成立,然后用这个加法和乘法来输出一个加法表和乘法表。 能够使式子成立的加法和乘法,实际上这个式子就是费马小定理: 假如p是质数,且gcd(a,p)=1,那么 a^(p-1)≡1(mod p) 这里再通过取...

2018-09-04 10:43:46 354

原创 hdu6438(贪心)

题目: The Power Cube is used as a stash of Exotic Power. There are n cities numbered 1,2,…,n where allowed to trade it. The trading price of the Power Cube in the i-th city is ai dollars per cube. Nosw...

2018-09-04 10:30:40 137

原创 hdu6441(本原勾股数)

题目: people in USSS love math very much, and there is a famous math problem . give you two integers n,a,you are required to find 2 integers b,c such that a^n+b^n=c^n. Input one line contains one in...

2018-09-04 10:18:06 497

原创 1.1 博弈论(sg函数)

博弈论 出自于省赛的丢人,算是第一篇博客吧,来学习博弈论 博弈论 巴什博弈 威佐夫博弈 Nim博弈 sg函数 题目+代码 HOJ1847(单堆取次幂) HOJ3980(环取连续段) POJ3537(同上一题,只不过要判断好子情况实际上最大是5个单位) poj1704(阶梯博弈) poj2425(在图上的Nim博弈) 斐波那契博弈 巴什博弈 只有一堆n个物品,...

2018-05-23 14:23:19 1248 2

原创 欢迎使用CSDN-markdown编辑器

快速幂LL fun(LL x,LL n,LL Max) { LL res=1; while(n>0) { if(n & 1) res=(res*x)%Max; x=(x*x)%Max; n >>= 1; } return res; }

2017-09-29 18:54:06 152

原创 2017 Summer Training Day1

A - Hexadecimal’s Numbers题目: One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loade

2017-08-02 00:27:21 275

原创 usaco 1.2.2

Milking cows/* ID: wangwen4 LANG: C++ TASK: milk2 */ #include<bits/stdc++.h> using namespace std;struct cow { int l; int r; }m[6000]; bool cmp(cow a,cow b) { return a.l < b.l; } int main()

2017-07-14 11:15:20 241

转载 凸边行判断

Shape of HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4643 Accepted Submission(s): 2080Problem Description 话说上回讲到海东集团推选老总的事情,最终的结果是

2017-07-12 13:47:38 418

原创 Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)

题目A. Vicious Keyboardtime limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Tonio has a keyboard with only two letters, “V” and “K”.One day, he ha

2017-04-18 19:46:03 481

原创 Codeforces Round#404 B. Anton and Classes

题目time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard output Anton likes to play chess. Also he likes to do programming. No wonder that he decided to

2017-03-16 15:48:08 280

原创 Codeforces Round#404 A. Anton and Polyhedrons

题目time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Anton’s favourite geometric figures are regular polyhedrons. Note that there are five kin

2017-03-16 15:40:53 376

原创 UVa213-信息解码

题目对于下面这个字符串: 0,00,01,10,000,001,010,011……. 首先是长度为1的串,然后是长度为2的串,以此类推。不存在全为1的串。 你的任务是编写一个程序。首先输入一个代码头(例如AB#TANCnrtXc),则上述序列的每个串依次对应编码头的每个字符。例如,0对应A,00对应B,01对应#…,0000对应c。接下来是编码文本(可能由多行组成,你应当把他们拼成一个长长的0

2017-03-02 11:10:37 771

原创 Codeforces Round #400 B.Sherlock and his girlfriend

题目Sherlock has a new girlfriend (so unlike him!). Valentine’s day is coming and he wants to gift her some jewelry.He bought n pieces of jewelry. The i-th piece has price equal to i + 1, that is, the pr

2017-02-25 21:06:21 728

原创 Codeforces Round #400(A) A.A Serial Killer

题目Our beloved detective, Sherlock is currently trying to catch a serial killer who kills a person each day. Using his powers of deduction, he came to know that the killer has a strategy for selecting h

2017-02-25 17:46:08 427

原创 UVa133

题目(n<20 )个人站成一圈,逆时针编号为1~n。有两个官员,A从1开始逆时针数,B从n开始顺时针数。在每一轮中,官员A数k个就停下来,官员B数m个就停下来(注意有可能两个官员停在同一个人上)。接下来被选中的人离开队伍。 输入n,k,m输出每轮被选中的人的编号(如果有两个人,先输出A的)每个输出数字正好占3列。代码 #include<iostream> #include<algorithm>

2017-02-23 19:26:14 640

原创 UVa 489

题目Hangman Judge是一个猜英文单字的小游戏(在电子字典中常会看到),游戏规则如下: 1、答案单字写在纸上(每个字元一张纸),并且被盖起来,玩家每次猜一个英文字元(letter)。 2、如果这个英文字元猜中(在答案的英文单字中有出现),被猜中的字元就被翻开。例如:答案是book,如果你猜o,book中的两个o就会被视为已猜中。 3、如果这个英文字元未出现在答案的单字中,就会在hang

2017-02-23 01:18:25 229

原创 UVa 1339

题目给定两个长度一样且不超过100的字符串,判断是否能把其中一个字符串的各个字母重排,之后对26个字母做一个一一映射,使得两个字符串相同。 例如,JWPUDJSTVP重排后可以得到WJDUPSJPVT,之后把每个字母映射到它的前面一个字母,得到VICTORIOUS,输入两个字符串,输出YES或者NO。代码 #include<algorithm> #include<cstring> using

2017-02-22 00:18:17 338

原创 HDU-2098

题目:把一个偶数拆成两个不同素数的和,有几种拆法呢? 代码:#include<iostream> #include<cmath> #include<cstring> using namespace std; int main() { long long array[10001]; memset(array,0,sizeof(array)); for(int i = 2,j =

2017-02-03 21:31:14 172

原创 HDU-2085

题目:某核反应堆有两类事件发生: 高能质点碰击核子时,质点被吸收,放出3个高能质点和1个低能质点; 低能质点碰击核子时,质点被吸收,放出2个高能质点和1个低能质点。 假定开始的时候(0微秒)只有一个高能质点射入核反应堆,每一微秒引起一个事件发生(对于一个事件,当前存在的所有质点都会撞击核子),试确定n微秒时高能质点和低能质点的数目。 代码:#include<iostream> long

2017-02-03 16:24:55 653 1

原创 第一次博客。。POJ-2499

第一次博客。。POJ-2499定义一个二叉树,根节点(1,1),设根节点(a,b),左儿子是(a+b,b),右儿子(a,b+a) 现在个你一个点(i,j),问从(1,1)走到(i,j)要向左多少次,向右多少次? input: 3 42 1 3 4 17 73 output: Scenario #1: 41 0Scenario #2: 2 1Scenario #3: 4 6代码:

2017-02-03 16:12:55 234

空空如也

空空如也

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

TA关注的人

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