A题   我仅仅想说题意非常坑,一不小心就会wa,哎,不机智的我居然在最后判题的过程中错了,少加一个推断语句。

错的值了,你说呢?

#include<map>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1.0)
#define inf 0xfffffff
#define maxn 5000
using namespace std;
int m,n;
struct node
{
int u;
int v;
}
a[maxn];
int main()
{
scanf("%d%d",&m,&n);
int flag=0;
int sum=0;
for(int i=1;i<=m;i++)
{
scanf("%d%d",&a[i].u,&a[i].v);
if(a[i].u<n) flag=1;
if(a[i].u==n&&a[i].v==0) flag=1;
a[i].v=100-a[i].v;
if(a[i].u<n||(a[i].u==n&&a[i].v==0))
if(a[i].v!=100) sum=max(sum,a[i].v);
}
if(flag==0) cout<<"-1"<<endl;
else cout<<sum<<endl;
return 0;
}

B题,找出在这个过程中最大的那个负数。然后取绝对值即可了。

#include<map>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#define pi acos(-1.0)
#define inf 0xfffffff
#define maxn 500000
using namespace std;
int n;
__int64 a[maxn];
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%I64d",&a[i]);
a[0]=0;
__int64 sum=0;
__int64 maa=maxn*100;
for(int i=1;i<=n;i++)
{
sum=a[i-1]-a[i];
maa=min(maa,sum);
a[i]+=sum;
// cout<<sum<<" "<<a[i]<<endl;
}
if(maa<0) maa*=-1;
cout<<maa<<endl;
return 0;
}

codeforces round #264(div2)的更多相关文章

  1. Codeforces Round #539 div2

    Codeforces Round #539 div2 abstract I 离散化三连 sort(pos.begin(), pos.end()); pos.erase(unique(pos.begin ...

  2. 【前行】◇第3站◇ Codeforces Round #512 Div2

    [第3站]Codeforces Round #512 Div2 第三题莫名卡半天……一堆细节没处理,改一个发现还有一个……然后就炸了,罚了一啪啦时间 Rating又掉了……但是没什么,比上一次好多了: ...

  3. Codeforces Round#320 Div2 解题报告

    Codeforces Round#320 Div2 先做个标题党,骗骗访问量,结束后再来写咯. codeforces 579A Raising Bacteria codeforces 579B Fin ...

  4. Codeforces Round #564(div2)

    Codeforces Round #564(div2) 本来以为是送分场,结果成了送命场. 菜是原罪 A SB题,上来读不懂题就交WA了一发,代码就不粘了 B 简单构造 很明显,\(n*n\)的矩阵可 ...

  5. Codeforces Round #361 div2

    ProblemA(Codeforces Round 689A): 题意: 给一个手势, 问这个手势是否是唯一. 思路: 暴力, 模拟将这个手势上下左右移动一次看是否还在键盘上即可. 代码: #incl ...

  6. Codeforces Round #626 Div2 D,E

    比赛链接: Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics) D.Present 题意: 给定大 ...

  7. CodeForces Round 192 Div2

    This is the first time I took part in Codeforces Competition.The only felt is that my IQ was contemp ...

  8. Codeforces Round #264 (Div. 2)

    http://codeforces.com/contest/463 这场是我人生第一场cf啊.. 悲剧处处是啊. 首先,看不懂题,完全理解不了啊.都是wa了好几次才过的 所以a和b这两sb题我做了1个 ...

  9. Codeforces Round #359 div2

    Problem_A(CodeForces 686A): 题意: \[ 有n个输入, +\space d_i代表冰淇淋数目增加d_i个, -\space d_i表示某个孩纸需要d_i个, 如果你现在手里 ...

随机推荐

  1. Django-随机验证码

    Python生成随机验证码,需要使用PIL模块. 安装: 1 pip3 install pillow 基本使用 1. 创建图片 from PIL import Image img = Image.ne ...

  2. glib windows下编译

    记录的比较粗糙,但是绝对可行的 一些小的瑕疵以后再解决吧 (android版本的过几天再贴,移植到android已经通过) msys+mingw包下载: http://sourceforge.net/ ...

  3. Settings点击Location(位置)后右上角的开关button不会消失

    MT8121/8382平台: 前几天又遇到一个源码的bug.在10寸平板上,进入设置界面,点击Location(位置)项,右上角Title处会显示一个开关button,用来开关定位服务.但点完Loca ...

  4. cpu_relax( )-----对自选循环等待(spin-wait loops)操作的优化【转】

    cpu_relax()-----对自选循环等待(spin-wait loops)操作的优化 转自:http://www.doc100.net/bugs/t/173547/index.html 在loc ...

  5. pymysql 线程安全pymysqlpool

    # -*-coding: utf-8-*- # Author : Christopher Lee # License: Apache License # File : test_example.py ...

  6. 5.flask知识点补充

    1.WTForms表单验证基本使用 flask-wtf是一个简化了WTForms操作的一个第三方库,WTForms表单的两个主要的功能jiushi就是验证用户提交数据的合法性以及渲染模板.当然还包括其 ...

  7. Markdown文件导出为HTML的小程序

    Markdown文件导出为HTML的小程序 为什么做 最近把一些学习经验记下来,总结成MarkDown文件,不知不觉已经有12篇了. Sublime Text 的 MarkDown Preview 插 ...

  8. 树上两点的最近公共祖先问题(Least Common Ancestors)

    概念: 对于有根树T的两个节点u,v,最近公共祖先LCA(T, u, v)表示一个节点 x, 满足 x 是 u , v 的祖先且 x 的深度尽可能的大.即从 u 到 v 的路径一定经过点 x. 算法: ...

  9. 使用 Hibernate 完成 HibernateUtils 类 (适用于单独使用Hibernate或Struts+Hibernate)

    package com.istc.Utilities; import org.hibernate.Session; import org.hibernate.SessionFactory; impor ...

  10. 洛谷——P1152 欢乐的跳

    P1152 欢乐的跳 题目描述 一个n个元素的整数数组,如果数组两个连续元素之间差的绝对值包括了[1,n-1]之间的所有整数,则称之符合“欢乐的跳”,如数组1 4 2 3符合“欢乐的跳”,因为差的绝对 ...