最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

CodeforcesRound#274(Div.2)解题报告_html/css

来源:动视网 责编:小采 时间:2020-11-27 15:56:36
文档

CodeforcesRound#274(Div.2)解题报告_html/css

CodeforcesRound#274(Div.2)解题报告_html/css_WEB-ITnose:题目地址:http://codeforces.com/contest/479 这次自己又只能做出4道题来。 A题:Expression 水题。 枚举六种情况求最大值即可。 代码如下: #include #include #include #include #include #include #include #in
推荐度:
导读CodeforcesRound#274(Div.2)解题报告_html/css_WEB-ITnose:题目地址:http://codeforces.com/contest/479 这次自己又只能做出4道题来。 A题:Expression 水题。 枚举六种情况求最大值即可。 代码如下: #include #include #include #include #include #include #include #in


题目地址:http://codeforces.com/contest/479

这次自己又只能做出4道题来。

A题:Expression

水题。

枚举六种情况求最大值即可。

代码如下:

#include #include #include #include #include #include #include #include #include #include #include using namespace std;#define LL __intint main(){ LL a, b, c, d[10]; while(scanf("%Id%Id%Id",&a,&b,&c)!=EOF) { d[0]=a*b*c; d[1]=(a+b)*c; d[2]=a+b+c; d[3]=a*(b+c); d[4]=a+b*c; d[5]=a*b+c; sort(d,d+6); printf("%Id\n",d[5]); } return 0;}

B题: Towers

水题。

每次都是将最多的拿出一个给最少的,直到最大的与最少的相差小于或等于1.

代码如下:

#include #include #include #include #include #include #include #include #include #include #include using namespace std;#define LL __intstruct node{ int x, num;}fei[1000];int cmp(node x, node y){ return x.x

C题: Exams

还是水。小贪心

小贪心。先按标记日期排个序,然后扫一遍即可,能用小的就优先考虑小的。

代码如下:

#include #include #include #include #include #include #include #include #include #include #include using namespace std;#define LL __intstruct node{ int x, y;}fei[6000];int cmp(node x, node y){ if(x.x==y.x) return x.y=k) { k=fei[i].y; } else { k=fei[i].x; } } printf("%d\n",k); } return 0;}

D题:

还是水。。二分。

分别考虑4种情况,x,y,x+y,y-x。然后用二分找差值为这四个数的。

代码如下:

#include #include #include #include #include #include #include #include #include #include #include using namespace std;#define LL __intint a[110000];int bin_search(int x, int y, int high){ int low=0, mid; while(low<=high) { mid=low+high>>1; if(y-a[mid]==x) return 1; else if(y-a[mid]>x) low=mid+1; else high=mid-1; } return 0;}int main(){ int n, l, x, y, i, j, k, flag1, flag2; while(scanf("%d%d%d%d",&n,&l,&x,&y)!=EOF) { flag1=flag2=0; for(i=0; i=0||a[i]+x<=l)) { flag=1; break; } } if(flag&&a[i]-y>=0) { printf("1\n%d\n",a[i]-y); } else if(flag&&a[i]+x<=l) { printf("1\n%d\n",a[i]+x); } else { printf("2\n%d %d\n",x,y); } } } } } return 0;}

文档

CodeforcesRound#274(Div.2)解题报告_html/css

CodeforcesRound#274(Div.2)解题报告_html/css_WEB-ITnose:题目地址:http://codeforces.com/contest/479 这次自己又只能做出4道题来。 A题:Expression 水题。 枚举六种情况求最大值即可。 代码如下: #include #include #include #include #include #include #include #in
推荐度:
标签: css div round
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top