自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

xlp的acm专栏

Littlefriends

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

原创 HNU 12850 Garage

长为H的格子里面放n个长为h的格子 最多会有n+1个空隙要使每个空隙长度都小于h (H-h*n)/(n+1)n>(H/h-1)/2#includeint main(){ int W,H,w,h; while(scanf("%d%d%d%d",&W,&H,&w,&h)==4) { int x=(int)ceil((W*1.0/w-1)/2),y

2014-07-29 10:32:42 761

原创 HNU 12848 Energy Tycoon (贪心)

贪心#includeusing namespace std;int main(){ long long n; char s[100020]; while(scanf("%I64d",&n)==1) { scanf("%s",s); int len=strlen(s); long long sum1=0,sum

2014-07-29 10:18:26 748

原创 HNU 12845 Ballot Analyzing Device

#includeusing namespace std;struct vote{ int x; string s;}v[20];bool cmp(vote a,vote b){ return a.x>b.x;}int main(){ int n,m; string str; scanf("%d%d",&n,&m); for(i

2014-07-29 10:15:24 729

原创 HNU 12844 Arrangement of Contest

#includeusing namespace std;int a[50];int main(){ char s[50]; int n; while(scanf("%d",&n)==1) { memset(a,0,sizeof(a)); getchar(); for(int i=1;i<=n;i++)

2014-07-29 10:11:21 720

原创 Codeforces 452A Eevee

#includeusing namespace std;string m[]={"vaporeon","jolteon","flareon","espeon","umbreon","leafeon","glaceon","sylveon"};int len[]={8,7,7,6,7,7,7,7};int main(){ int n,ans; char s[20];

2014-07-29 10:01:43 794

原创 Codeforces 218B Airport

max_element()取数组最大元素min_element()取数组最小元素

2014-07-27 11:34:14 663

原创 Codeforces 363A Soroban

算盘的模拟#includeusing namespace std;int main(){ char s[20]; scanf("%s",&s); int len=strlen(s); for(int i=len-1;i>=0;i--) { if(s[i]>='5'&&s[i]<='9') {

2014-07-27 10:24:12 840

原创 Codeforces 361A Levko and Table

在n*n矩阵的对角线上输出k即可#includeusing namespace std;int main(){ int n,k; scanf("%d%d",&n,&k); for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { if(j!=1)

2014-07-27 10:09:05 706

原创 Codeforces 344B Simple Molecules

#includeusing namespace std;int main(){ int a,b,c; scanf("%d%d%d",&a,&b,&c); int ab=a+b-c,bc=b+c-a,ac=a+c-b; if(ab>=0&&bc>=0&&ac>=0&&ab%2==0&&bc%2==0&&ac%2==0) printf("%d %d

2014-07-27 10:04:04 906

原创 HDU 4858 项目管理

BestCoder Round #1数据不大

2014-07-27 09:21:02 756

原创 POJ 3311 Hie with the Pie (状压DP)

状态压缩DPdp[i][j]表示在i状态(用二进制表示城市有没有经过)时最后到达j城市的最小时间转移方程dp[i][j]=min(dp[i][k]+d[k][j],dp[i][j])  d[k][j]是k城市到j城市的最短距离 要先用flody处理#includeusing namespace std;int d[20][20],dp[1<<11][20];int n,m;

2014-07-27 08:53:43 850

原创 Codeforces 279B Books

#includeusing namespace std;int a[100020];int main(){ int n,t; scanf("%d%d",&n,&t); int sum=0,k=1,Max=0; for(int i=1;i<=n;i++) { scanf("%d",&a[i]); sum+=a[i];

2014-07-26 19:40:07 1018

原创 HNU 12834 Thread Tree

递归输出就行了#includeusing namespace std;struct tree{ int dot; string s;}t[1020];int si[1020],a[1020][1020];void print(int x){ for(int i=0;i<=si[x]-1;i++) { for(int j=1;j<=t[

2014-07-26 18:36:33 791

原创 POJ 1611 The Suspects(并查集)

并查集

2014-07-26 10:31:43 772

原创 POJ 1125 Stockbroker Grapevine (Floyd最短路)

Floyd算法计算每对顶点之间的最短路径的问题题目中隐含了一个条件是一个人可以同时将谣言传递给多个人题目最终的要求是时间最短,那么就要遍历一遍求出每个点作为源点时,最长的最短路径长是多少,再求这些值当中最小的是多少,就是题目所求#includeusing namespace std;int n,x,p,t;int m[120][120],dist[120][120],Max[12

2014-07-26 10:28:47 879

原创 ZOJ 3721 Final Exam Arrangement (贪心)

按每场考试开始的时间排序后贪心

2014-07-25 16:02:22 514

原创 HDU 4861 Couple doubi (费马小定理)

费马小定理

2014-07-25 10:35:28 478

原创 HDU 4882 ZCC Loves Codefires (贪心)

贪心

2014-07-25 10:17:32 534

原创 NBUT 1583 小朋友们,还记得我是谁吗?对了,我就是光头郑昱

#includeusing namespace std;int main(){ int N,P,M; while(scanf("%d",&N)==1) { int sum=0,Min=0; for(int i=1;i<=N;i++) { scanf("%d%d",&P,&M);

2014-07-25 10:00:31 649

原创 Codeforces 451D Count Good Substrings

动态规划从前往后记录a和b出现的次数和位置两边字母

2014-07-25 09:48:45 561

原创 Codeforces 451C Predict Outcome of the Game

枚举所有可能的情况#includeusing namespace std;typedef long long LL;int solve(LL n,LL k,LL d1,LL d2){ if(n%3!=0) return 0; for(int i=-1;i<=1;i++) { for(int j=-1;j<=1;j++)

2014-07-25 09:44:09 542

原创 Codeforces 451B Sort the Array

找出递减序列 如果递减序列只有一个bingqie

2014-07-25 09:42:58 787

原创 Codeforces 451A Game With Sticks

结果与所有人的策略无关

2014-07-25 09:42:23 533

原创 Codeforces 450B Jzzhu and Sequences

由题意得f[1]=x,f[2]=y,f[3]=y-x,f[4]=-x,f[5]=-y,f[6]=x-yra

2014-07-21 14:16:37 684

原创 Codeforces 450A Jzzhu and Children

求出每个孩子可以

2014-07-21 14:13:21 526

原创 NBUT 1586 买票回家啦

队友想到一个比较简单的fang

2014-07-21 13:50:18 586

原创 NBUT 1585 字符串大处理

CapsLock和Shift实际上是一样的

2014-07-21 13:50:02 545

原创 NBUT 1584 机械键盘,你值得拥有

模拟题#includeusing namespace std;int len[20];char s[120][120];int sum;char key[120][120]={{'1','2','3','4','5','6','7','8','9','0','-','='},{'q','w','e','r','t','y','u','i','o','p','[',']','\\'},

2014-07-21 13:44:05 702

原创 NBUT 1582 比赛吃鸡腿

博弈论具体推理过程不写了

2014-07-21 13:41:20 624

原创 NBUT 1576 炒鸡想减肥的字符串

NBUT1052的加强版还是原来的方法做

2014-07-21 13:36:40 818 3

原创 Codeforces 448B Suffix Structures

如果t是s的子串 输出"automaton"如果

2014-07-18 10:51:35 467

原创 Codeforces 448D Multiplication Table

在1到n*m+1之间二分查找求出从小到大第k个数(注意不是第k

2014-07-18 10:43:40 653

原创 Codeforces 448A Rewards

#includeusing namespace std;int main(){ int n,a1,a2,a3,b1,b2,b3,a,b; scanf("%d%d%d%d%d%d%d",&a1,&a2,&a3,&b1,&b2,&b3,&n); a=(a1+a2+a3+4)/5,b=(b1+b2+b3+9)/10; if(n>=a+b) print

2014-07-18 10:43:32 522

原创 NBUT 1052 想减肥的字符串

#includeusing namespace std;char s[1020];int main(){ while(scanf("%s",s)!=EOF) { int ans=INT_MAX; int a=-1,b=-1,c=-1; int len=strlen(s); for(int i=0;i<len;i

2014-07-18 10:17:08 952 3

原创 Codeforces 446A DZY Loves Sequences

求出l[i] 满足a[i-l[i]+1]求出r[i] 满足a[i+l[i]+1]

2014-07-14 09:18:32 581

原创 Codeforces 447B DZY Loves Strings

加入的K个字符x使w[x]最大即可 genj

2014-07-14 09:12:10 697

原创 Codeforces 447A DZY Loves Hash

建立一个数组来存储插入的数 判断冲突的发生jike

2014-07-14 09:11:02 574

原创 NBUT 1573 字符串大配对

#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing names

2014-07-11 17:27:44 1148

原创 STL

begin() 返回指向第一个元素的迭代器clear() 清除所有元素count() 返回某个值元素的个数empty() 如果集合为空,返回true(真)end() 返回指向最后一个元素之后的迭代器,不是最后一个元素equal_range() 返回集合中与给定值相等的上下限的两个迭代器erase() 删除集合中的元素find() 返回一个指向被查找到元素的迭代器get_alloca

2014-07-11 15:28:53 478

原创 Codeforces 444A DZY Loves Physics

If there is a connected induced subgraph containing more than 2 nodes with the maximum density. The density of every connected induced subgraph of it that contains only one edge can be represented a

2014-07-11 11:23:59 513

空空如也

空空如也

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

TA关注的人

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