首页 web前端 html教程 Codeforces Round #274 (Div. 2) 解题报告_html/css_WEB-ITnose

Codeforces Round #274 (Div. 2) 解题报告_html/css_WEB-ITnose

Jun 24, 2016 am 11:56 AM

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

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

A题:Expression

水题。

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

代码如下:

#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 __int64int main(){    LL a, b, c, d[10];    while(scanf("%I64d%I64d%I64d",&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("%I64d\n",d[5]);    }    return 0;}</algorithm></set></map></queue></ctype.h></math.h></stdlib.h></cstring></string></cstdio></iostream>
登录后复制

B题: Towers

水题。

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

代码如下:

#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 __int64struct node{    int x, num;}fei[1000];int cmp(node x, node y){    return x.x<y.x a b main int n m i j cnt ans while for scanf fei sort if break printf return>  <br> C题: Exams  <p></p>  <p>还是水。。小贪心</p>  <p>小贪心。先按标记日期排个序,然后扫一遍即可,能用小的就优先考虑小的。</p>  <p>代码如下:</p>  <p></p>  <pre name="code" class="sycode">#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 __int64struct node{    int x, y;}fei[6000];int cmp(node x, node y){    if(x.x==y.x)        return x.y<y.y return x.x main int n i j ans k x1 x2 while for scanf sort if>=k)            {                k=fei[i].y;            }            else            {                k=fei[i].x;            }        }        printf("%d\n",k);    }    return 0;}</y.y></algorithm></set></map></queue></ctype.h></math.h></stdlib.h></cstring></string></cstdio></iostream>
登录后复制

D题:

还是水。。。。二分。

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

代码如下:

#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 __int64int a[110000];int bin_search(int x, int y, int high){    int low=0, mid;    while(low>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<n i scanf if flag1="1;" flag2="1;" printf else for break int flag="0;">=0||a[i]+x=0)                    {                        printf("1\n%d\n",a[i]-y);                    }                    else if(flag&&a[i]+x  <br>  <br>  <p></p>  <p><br> </p> </n></algorithm></set></map></queue></ctype.h></math.h></stdlib.h></cstring></string></cstdio></iostream>
登录后复制
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

HTML容易为初学者学习吗? HTML容易为初学者学习吗? Apr 07, 2025 am 12:11 AM

HTML适合初学者学习,因为它简单易学且能快速看到成果。1)HTML的学习曲线平缓,易于上手。2)只需掌握基本标签即可开始创建网页。3)灵活性高,可与CSS和JavaScript结合使用。4)丰富的学习资源和现代工具支持学习过程。

&gt; gt;的目的是什么 元素? &gt; gt;的目的是什么 元素? Mar 21, 2025 pm 12:34 PM

本文讨论了HTML&lt; Progress&gt;元素,其目的,样式和与&lt; meter&gt;元素。主要重点是使用&lt; progress&gt;为了完成任务和LT;仪表&gt;对于stati

HTML,CSS和JavaScript的角色:核心职责 HTML,CSS和JavaScript的角色:核心职责 Apr 08, 2025 pm 07:05 PM

HTML定义网页结构,CSS负责样式和布局,JavaScript赋予动态交互。三者在网页开发中各司其职,共同构建丰富多彩的网站。

&lt; datalist&gt;的目的是什么。 元素? &lt; datalist&gt;的目的是什么。 元素? Mar 21, 2025 pm 12:33 PM

本文讨论了html&lt; datalist&gt;元素,通过提供自动完整建议,改善用户体验并减少错误来增强表格。Character计数:159

&lt; meter&gt;的目的是什么。 元素? &lt; meter&gt;的目的是什么。 元素? Mar 21, 2025 pm 12:35 PM

本文讨论了HTML&lt; meter&gt;元素,用于在一个范围内显示标量或分数值及其在Web开发中的常见应用。它区分了&lt; meter&gt;从&lt; progress&gt;和前

HTML中起始标签的示例是什么? HTML中起始标签的示例是什么? Apr 06, 2025 am 12:04 AM

AnexampleOfAstartingTaginHtmlis,beginSaparagraph.startingTagSareEssentialInhtmlastheyInitiateEllements,defiteTheeTheErtypes,andarecrucialforsstructuringwebpages wepages webpages andConstructingthedom。

了解HTML,CSS和JavaScript:初学者指南 了解HTML,CSS和JavaScript:初学者指南 Apr 12, 2025 am 12:02 AM

WebDevelovermentReliesonHtml,CSS和JavaScript:1)HTMLStructuresContent,2)CSSStyleSIT和3)JavaScriptAddSstractivity,形成thebasisofmodernWebemodernWebExexperiences。

Gitee Pages静态网站部署失败:单个文件404错误如何排查和解决? Gitee Pages静态网站部署失败:单个文件404错误如何排查和解决? Apr 04, 2025 pm 11:54 PM

GiteePages静态网站部署失败:404错误排查与解决在使用Gitee...

See all articles