多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國(guó)內(nèi)最全I(xiàn)T社區(qū)平臺(tái) 聯(lián)系我們 | 收藏本站
阿里云優(yōu)惠2
您當(dāng)前位置:首頁(yè) > php開(kāi)源 > php教程 > Codeforces Round #281 (Div. 2) 解題報(bào)告 A.B.C.D.

Codeforces Round #281 (Div. 2) 解題報(bào)告 A.B.C.D.

來(lái)源:程序員人生   發(fā)布時(shí)間:2014-12-18 08:17:33 閱讀次數(shù):3447次

A - Vasya and Football

純摹擬。。比較坑的是會(huì)有不符合足球常識(shí)的地方。。

代碼以下:

#include <iostream> #include <cstdio> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <queue> #include <map> #include <set> #include <algorithm> using namespace std; #define LL __int64 const int INF=0x3f3f3f3f; struct node { int num, time, f; char ah; }fei[100]; int cmp(node x, node y) { return x.time<y.time; } int foul(char c) { if(c=='y') return 1; return 2; } int main() { char s1[30], s2[30], c1, c2; int n, i, j, t, cnt=0, num, flag; scanf("%s%s",s1,s2); scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d %c %d %c",&t,&c1,&num,&c2); flag=0; for(j=0;j<cnt;j++){ if(fei[j].ah==c1&&fei[j].num==num) { fei[j].f+=foul(c2); if(fei[j].f-foul(c2)<2) fei[j].time=t; flag=1; break; } } if(!flag){ fei[cnt].num=num; fei[cnt].time=t; fei[cnt].ah=c1; fei[cnt++].f=foul(c2); } } sort(fei,fei+cnt,cmp); for(i=0;i<cnt;i++){ if(fei[i].f>=2){ if(fei[i].ah=='h') printf("%s ",s1); else printf("%s ",s2); printf("%d %d ",fei[i].num,fei[i].time); } } return 0; }

B - Vasya and Wrestling

水題。。先比較和然后再根據(jù)題意比較字典序便可。實(shí)在沒(méi)啥好說(shuō)的。。

代碼以下:

#include <iostream> #include <cstdio> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <queue> #include <map> #include <set> #include <algorithm> using namespace std; #define LL __int64 const int INF=0x3f3f3f3f; LL a[210000], b[210000]; int main() { LL cnt1=0, cnt2=0, n, x, s1=0, s2=0, t; int i; scanf("%I64d",&n); while(n--){ scanf("%I64d",&x); if(x>0){ a[cnt1++]=x; s1+=x; } else{ b[cnt2++]=-x; s2-=x; } if(n==0) t=x>0?1:2; } if(s1>s2) printf("first "); else if(s1<s2) printf("second "); else{ int flag=0; for(i=0;i<cnt1&&i<cnt2;i++){ if(a[i]>b[i]){ flag=1; break; } else if(a[i]<b[i]){ flag=2; break; } } if(flag==1) puts("first"); else if(flag==2) puts("second"); else if(cnt1>cnt2) puts("first"); else if(cnt1<cnt2) puts("second"); else if(t==1) puts("first"); else puts("second"); } return 0; }
C - Vasya and Basketball

也是1水題。。不過(guò)我直接跪了。。各種細(xì)節(jié)手殘。。竟然錯(cuò)了11次。。。。。中間還交到D題去了1次。。。

先把各種出現(xiàn)過(guò)的數(shù)存起來(lái),排序,然后分別2分判斷兩人有多少個(gè)2分,有多少3分的,找最大值便可。

代碼以下:

#include <iostream> #include <cstdio> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <queue> #include <map> #include <set> #include <algorithm> using namespace std; #define LL __int64 const int INF=0x3f3f3f3f; int a[210000], b[210000], n, m, c[420000], f[420000]; int bin_search(int d[], int x, int high) { int low=1, mid, ans=0; while(low<=high) { mid=low+high>>1; if(d[mid]<=x) { ans=mid; low=mid+1; } else high=mid⑴; } return ans; } int main() { int i, j, aa, bb, max1=⑵*1e9, x, y, z, cnt=1, p1, p2; scanf("%d",&n); for(i=1; i<=n; i++) { scanf("%d",&a[i]); c[i]=a[i]; } scanf("%d",&m); for(i=1; i<=m; i++) { scanf("%d",&b[i]); c[i+n]=b[i]; } sort(c+1,c+n+m+1); sort(a+1,a+n+1); sort(b+1,b+m+1); c[0]=0; f[0]=0; for(i=1;i<=n+m;i++){ if(c[i]!=c[i⑴]){ f[cnt++]=c[i]; } } for(i=0;i<cnt;i++){ x=bin_search(a,f[i],n); y=bin_search(b,f[i],m); p1=x*2+(n-x)*3; p2=y*2+(m-y)*3; if(max1<p1-p2){ max1=p1-p2; aa=p1; bb=p2; } } printf("%d:%d ",aa,bb); return 0; }


D - Vasya and Chess

料想題、、所以我是猜的、、證明不會(huì)。。

代碼以下:

#include <iostream> #include <cstdio> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <queue> #include <map> #include <set> #include <algorithm> using namespace std; #define LL __int64 const int INF=0x3f3f3f3f; int main() { int n; scanf("%d",&n); if(n%2==0) printf("white 1 2 "); else printf("black "); return 0; }


生活不易,碼農(nóng)辛苦
如果您覺(jué)得本網(wǎng)站對(duì)您的學(xué)習(xí)有所幫助,可以手機(jī)掃描二維碼進(jìn)行捐贈(zèng)
程序員人生
------分隔線(xiàn)----------------------------
分享到:
------分隔線(xiàn)----------------------------
關(guān)閉
程序員人生
主站蜘蛛池模板: 最近中文字幕高清mv免费 | 欧美性播放 | 欧美国产综合视频 | 亚洲国产成人99精品激情在线 | 一级在线毛片 | 欧美国产日韩一区二区三区 | 日韩欧美中文字幕一区 | 久久一本精品久久精品66 | 日韩欧美亚洲一区 | 免费观看18视频网站 | 美女上床网站 | 九九精 | 欧美jizz| 国产福利一区二区精品免费 | 国产香蕉偷在线观看视频 | 性欧美video另类hd亚洲人 | 国产精品日韩 | 欧美大片aaaa一级毛片 | 黄色欧美一级片 | 亚洲国产激情在线一区 | 国产亚洲精品福利片 | 亚洲精品国产不卡在线观看 | 国产成人综合网亚洲欧美在线 | 久久综合久久久 | 免费看国产精品久久久久 | 欧美日韩乱国产 | 欧美亚洲国产色综合 | 女人一级毛片免费观看 | 九九热国产精品视频 | 亚洲欧美日韩高清在线看 | 国产成人啪精品视频免费网 | 亚洲页码 | 中文字幕第一页亚洲 | 99精品久久秒播无毒不卡 | 九九久久香港经典三级精品 | 国产欧美国产精品第一区 | 亚洲精品久久片久久 | 精品在线视频一区 | 视频久久精品 | www.色网| 我爱52av好色 |