- 博客(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 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
原创 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 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
原创 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 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 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
原创 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
原创 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
原创 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关注的人