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. cve-2012-5613 mysql本地提权

    cve-2012-5613  是一个通过FILE权限写Trigger的TRG存储文件(即伪造Trigger),由root触发而导致权限提升的漏洞.不知道为什么这个漏洞一直没修,可能mysql认为这是一 ...

  2. Python爬虫学习 - day2 - 站点登陆

    利用Python完成简单的站点登陆 最近学习到了爬虫,瞬时觉得很高大上,想取什么就取什么,感觉要上天.这里分享一个简单的登陆抽屉新热榜的教程(因为它不需要验证码,目前还没有学会图像识别.哈哈),供大家 ...

  3. POJ2255(二叉树遍历)

    Tree Recovery Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13000   Accepted: 8112 De ...

  4. POJ1258 (最小生成树prim)

    Agri-Net Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 46319   Accepted: 19052 Descri ...

  5. python基础===python3中 http.client 和 urllib的那些事

    import http.client #python3中没有了 httplib的库 #python 3.x中urllib库和urilib2库合并成了urllib库.. #其中urllib2.urlop ...

  6. celery-分布式任务队列-原理

    # 转自:https://www.cnblogs.com/forward-wang/p/5970806.html 在学习Celery之前,我先简单的去了解了一下什么是生产者消费者模式. 生产者消费者模 ...

  7. 5分钟在Mac上从0配置安装laravel5.5

    1.安装包管理工具homebrew ,相当于ubuntu的apt-get 在iTerm命令行输入: /usr/bin/ruby -e "$(curl -fsSL https://raw.gi ...

  8. c#实现Form窗体始终在桌面最前端显示

    方法一 //调用API [System.Runtime.InteropServices.DllImport("user32", CharSet = System.Runtime.I ...

  9. Python 统一动态创建多个model对应的modelForm类(type()函数)

    一.ModelForm的用法 ModelForm对用户提交的数据有验证功能,但比Form要简单的多 from django.forms import ModelForm # 导入ModelFormcl ...

  10. MySQL 使用硬链接配合truncate 删除2.2T的表

    1 创建tmp 表并 rename 表 mysql> rename table ep to ep_bak; Query OK, 0 rows affected (0.07 sec) mysql& ...