这道题之前没注意到at least,审题不仔细啊,两个问题解法还是有些许区别的

有at least的

#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
using namespace std; #define mem(a,b) memset(a,b,sizeof(a))
#define pf printf
#define sf scanf
#define debug printf("!\n")
#define INF 10000
#define MAX(a,b) a>b?a:b
#define blank pf("\n")
#define LL long long int a[],b[],tt[]; int main()
{
int i,j,r,t;
int res=;
mem(tt,);
for(i=;i<;i++)
{
sf("%d",&a[i]);
}
for(i=;i<;i++)
{
sf("%d",&b[i]);
}
//pf("sum%d\n",sum);
for(i=;i<;i++)
{
int tmp = a[i]-b[i];
//pf("tmp%d\n",tmp);
if(tmp<)
tt[i]=tmp;
else
{
res+=tmp/;
tt[i]=;
}
}
for(i = ;i<;i++)
res+=tt[i];
//pf("n%d p%d\n",n,p);
if(res>=)
pf("Yes\n");
else
pf("No\n"); return ;

无at least的,即exactly(应该是对的)

#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <stack>
using namespace std; #define mem(a,b) memset(a,b,sizeof(a))
#define pf printf
#define sf scanf
#define debug printf("!\n")
#define INF 10000
#define MAX(a,b) a>b?a:b
#define blank pf("\n")
#define LL long long int a[],b[]; int main()
{
int i,j,r,t;
int suma=,sumb=,sum,res=,p=,n=;
for(i=;i<;i++)
{
sf("%d",&a[i]);
suma+=a[i];
}
for(i=;i<;i++)
{
sf("%d",&b[i]);
sumb+=b[i];
}
sum=suma-sumb;
//pf("sum%d\n",sum);
for(i=;i<;i++)
{
int tmp = a[i]-b[i];
//pf("tmp%d\n",tmp);
if(tmp<)
n+=abs(tmp);
else
{
if(tmp%==)
p+=tmp/;
else
{
p+=(tmp+)/;
n++;
}
}
}
//pf("n%d p%d\n",n,p);
if(n==p && n==sum)
pf("Yes\n");
else
pf("No\n"); return ;
}

CodeForces 606A(水)的更多相关文章

  1. 【CodeForces 606A】A -特别水的题1-Magic Spheres

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102271#problem/A Description Carl is a beginne ...

  2. Codeforces 刷水记录

    Codeforces-566F 题目大意:给出一个有序数列a,这个数列中每两个数,如果满足一个数能整除另一个数,则这两个数中间是有一条边的,现在有这样的图,求最大联通子图. 题解:并不需要把图搞出来, ...

  3. CodeForces 606A Magic Spheres

    水题 /* *********************************************** Author :Zhou Zhentao Email :774388357@qq.com C ...

  4. Pearls in a Row CodeForces 620C 水题

    题目:http://codeforces.com/problemset/problem/620/C 文章末有一些测试数据仅供参考 题目大意 给你一个数字串,然后将分成几个部分,要求每个部分中必须有一对 ...

  5. 【Codeforces自我陶醉水题篇~】(差17C code....)

    Codeforces17A 题意: 有一种素数会等于两个相邻的素数相加 如果在2~n的范围内有至少k个这样的素数,就YES,否则就NO; 思路: 采用直接打表,后面判断一下就好了.那个预处理素数表还是 ...

  6. CodeForces 327B 水题。

    I - 9 Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Statu ...

  7. Lottery - CodeForces 589I(水)

    题目大意:有N个球K个人,现在要给这N个球涂上K种颜色,要求使抽到球的不同颜色的概率一致(N确保是K的倍数),求出来至少要给多少个球重新涂上颜色. 分析:先求出来所有球的每种颜色的个数,然后不到平均数 ...

  8. Codeforces - 631B 水题

    注意到R和C只与最后一个状态有关 /*H E A D*/ struct node2{ int kind,las,val,pos; node2(){} node2(int k,int l,int v,i ...

  9. Codeforces 734C [水][暴力][贪心]

    题意: 要生产n个物品,每个花费时间为x. 有两种魔法,每种最多使用1个. 其中第一种魔法可以使每个物品生产的花费时间变为ai,相应的花费是bi;第二种魔法可以减少ci个物品,相应的花费是di,并且保 ...

随机推荐

  1. Redis Sentinel初体验

        自Redis增加Sentinel集群工具以来,本博主就从未尝试过使用该工具.最近在调研目前主流的Redis集群部署方案,所以详细地看了一遍官方对于Sentinel的介绍并在自己的台式机上完成了 ...

  2. [Swift]遍历集合类型(数组、集合和字典)

    Swift提供了三种主要的集合类型,称为数组,集合和字典,用于存储值集合. 数组是有序的值集合. 集是唯一值的无序集合. 字典是键值关联的无序集合. Swift中无法再使用传统形式的for循环. // ...

  3. UDP的优点

    UDP优点 关于何时.发送什么数据的应用层控制更为精细 只需要应用层把数据传给UDP,UDP就把数据打包到网络层.对于TCP来说,存在一个拥塞控制机制,当链路变得拥塞时,会抑制TCP发送方,并造成数据 ...

  4. Swift中的Weak Strong Dance

    亲爱的博客园的关注着博主文章的朋友们告诉你们一个很不幸的消息哦, 这篇文章将会是博主在博客园发表的最后一篇文章咯, 因为之后的文章博主只会发布到这里哦 http://daiweilai.github. ...

  5. java开发注解大全

    目录 1.最基础注解(spring-context包下的org.springframework.stereotype) 1.1.@Controller @Service @Repository @Co ...

  6. C#生成验证码类

    using System;using System.Collections.Generic;using System.Drawing;using System.Drawing.Drawing2D;us ...

  7. js根据经纬度计算两点距离

    js版-胡老师 google.maps.LatLng.prototype.distanceFrom = function(latlng) {    var lat = [this.lat(), lat ...

  8. DGIS之遥感影像数据获取

    1.概要 在GIS圈的同行或多或少接触过遥感,记得在大学老师就说过"数据是GIS的核心".本文介绍在国内下载遥感影像的方法. 地理空间数据云,这个是中科院计算机网络中心建设的一个免 ...

  9. Mac 10.12安装Google浏览器

    说明:先安装旧版本后续再升级,主要是资源难找. 下载: (链接: https://pan.baidu.com/s/1eROfQyY 密码: n6ij)

  10. (转)mysql双机热备的实现

    mysql双机热备的实现 原文:http://www.zjian.me/web/php/mysql%E5%8F%8C%E6%9C%BA%E7%83%AD%E5%A4%87%E7%9A%84%E5%AE ...