codeforces round #264(div2)
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)的更多相关文章
- Codeforces Round #539 div2
Codeforces Round #539 div2 abstract I 离散化三连 sort(pos.begin(), pos.end()); pos.erase(unique(pos.begin ...
- 【前行】◇第3站◇ Codeforces Round #512 Div2
[第3站]Codeforces Round #512 Div2 第三题莫名卡半天……一堆细节没处理,改一个发现还有一个……然后就炸了,罚了一啪啦时间 Rating又掉了……但是没什么,比上一次好多了: ...
- Codeforces Round#320 Div2 解题报告
Codeforces Round#320 Div2 先做个标题党,骗骗访问量,结束后再来写咯. codeforces 579A Raising Bacteria codeforces 579B Fin ...
- Codeforces Round #564(div2)
Codeforces Round #564(div2) 本来以为是送分场,结果成了送命场. 菜是原罪 A SB题,上来读不懂题就交WA了一发,代码就不粘了 B 简单构造 很明显,\(n*n\)的矩阵可 ...
- Codeforces Round #361 div2
ProblemA(Codeforces Round 689A): 题意: 给一个手势, 问这个手势是否是唯一. 思路: 暴力, 模拟将这个手势上下左右移动一次看是否还在键盘上即可. 代码: #incl ...
- Codeforces Round #626 Div2 D,E
比赛链接: Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics) D.Present 题意: 给定大 ...
- CodeForces Round 192 Div2
This is the first time I took part in Codeforces Competition.The only felt is that my IQ was contemp ...
- Codeforces Round #264 (Div. 2)
http://codeforces.com/contest/463 这场是我人生第一场cf啊.. 悲剧处处是啊. 首先,看不懂题,完全理解不了啊.都是wa了好几次才过的 所以a和b这两sb题我做了1个 ...
- Codeforces Round #359 div2
Problem_A(CodeForces 686A): 题意: \[ 有n个输入, +\space d_i代表冰淇淋数目增加d_i个, -\space d_i表示某个孩纸需要d_i个, 如果你现在手里 ...
随机推荐
- bzoj 2064 DP
这道题可以抽象成两个数列,将一个数列变换为另一个 数列的代价最小 首先我们可以处理出所有的状态代表,对于每个状态 用二进制来表示,代表的是两个数列中的每一项选还是不选 那么答案最多为n1+n2-2,也 ...
- C++ 异常~一 转
C++ 异常机制分析 阅读目录 C++异常机制概述 throw 关键字 异常对象 catch 关键字 栈展开.RAII 异常机制与构造函数 异常机制与析构函数 noexcept修饰符与noexce ...
- unicode字符串解码显示
# encoding: utf-8 ''' unicode字符串解码显示 ''' import sys reload(sys) sys.setdefaultencoding('utf-8') a = ...
- C语言ASM汇编内嵌语法
转载:http://www.cnblogs.com/latifrons/archive/2009/09/17/1568198.html C语言ASM汇编内嵌语法 .3 GCC Inline ASM G ...
- ReadOnly与Enabled
txtDlrCode.ReadOnly = true; 1.当设置为只读,文本框有点击事件,点击该文本框还是可以响应点击事件 2.设置为只读,C#后台无法取得文本框的值,txtDlrCode.Text ...
- 【反演复习计划】【51nod1594】Gcd and Phi
现在感觉反演好多都是套路QAQ…… #include<bits/stdc++.h> using namespace std; ; typedef long long ll; int n,c ...
- Delphi2007新功能 -- 有限的栈对象
今天使用Delphi2007,一个误输入,无意中发现Delphi2007的record类型居然能够和TObject一样定义方法和属性,而且不需要调用类似TObject.Create方法就能生成一个re ...
- SQLAlchemy技术文档(中文版)-下
10.建立联系(外键) 是时候考虑怎样映射和查询一个和Users表关联的第二张表了.假设我们系统的用户可以存储任意数量的email地址.我们需要定义一个新表Address与User相关联. from ...
- Unable to connect to vulnerability scanner
问题: "Unable to connect to vulnerability scanner. If the system has been updated recently the ...
- dart Stream