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. [bzoj2599][IOI2011]Race——点分治

    Brief Description 给定一棵带权树,你需要找到一个点对,他们之间的距离为k,且路径中间的边的个数最少. Algorithm Analyse 我们考虑点分治. 对于子树,我们递归处理,所 ...

  2. Iframe跨域嵌入页面自动调整高度的办法

    http://www.a.com/A.html http://www.a.com/B.html http://www.a.com/D.js http://www.c.com/C.html A.html ...

  3. Windows 的GUID

    GUID(全称:Globally Unique Identifier),是一种由算法生成的二进制长度为128位的数字标识符.GUID主要用于在拥有多个节点.多台计算机的网络或系统中.在理想情况下,任何 ...

  4. System and method for parallel execution of memory transactions using multiple memory models, including SSO, TSO, PSO and RMO

    A data processor supports the use of multiple memory models by computer programs. At a device extern ...

  5. 关于oracle的连接时ORA-12519错误的解决方案

    系统在运行时出现了ORA-12519的错误,无法连接数据库,后来在网上找了下,找到了如下的解决方法,共享下. OERR: ORA-12519 TNS:no appropriate service ha ...

  6. pytest学习(3)

    在pytest 2.0以上的版本里,我们也可以通过python -m pytest ...来调用.这实际上和pytest ...几乎一摸一样. 只是用python的时候,把当面目录也加入到sys.pa ...

  7. Codeforces 810 A.Straight «A»

    A. Straight «A»   time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  8. 开源的图像滤镜库----for Android

    1.GPUImage for Android(推荐使用) GPUImage基于OpenGL实现的各种各样图像滤镜(图像处理)效果,多达50多种, idea源于GPUImage for iOS,基本囊括 ...

  9. A - Enterprising Escape 【BFS+优先队列+map】

    The Enterprise is surrounded by Klingons! Find the escape route that has the quickest exit time, and ...

  10. hdu4757(可持久化 Trie )

    hdu4757 题意 给出一棵树,每个节点有权值,每次查询节点 \((u, v)\) 以及 \(x\) ,问 \(u\) 到 \(v\) 路径上的某个节点与 \(x\) 异或最大的值是多少. 分析 T ...