codeforceA. Piles With Stones【水题】

A. Piles With Stones

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

There is a beautiful garden of stones in Innopolis.

Its most beautiful place is the nn piles with stones numbered from 11 to nn.

EJOI participants have visited this place twice.

When they first visited it, the number of stones in piles was x1,x2,…,xnx1,x2,…,xn, correspondingly. One of the participants wrote down this sequence in a notebook.

They visited it again the following day, and the number of stones in piles was equal to y1,y2,…,yny1,y2,…,yn. One of the participants also wrote it down in a notebook.

It is well known that every member of the EJOI jury during the night either sits in the room 108108 or comes to the place with stones. Each jury member who comes there either takes one stone for himself or moves one stone from one pile to another. We can assume that there is an unlimited number of jury members. No one except the jury goes to the place with stones at night.

Participants want to know whether their notes can be correct or they are sure to have made a mistake.

Input

The first line of the input file contains a single integer nn, the number of piles with stones in the garden (1≤n≤501≤n≤50).

The second line contains nn integers separated by spaces x1,x2,…,xnx1,x2,…,xn, the number of stones in piles recorded in the notebook when the participants came to the place with stones for the first time (0≤xi≤10000≤xi≤1000).

The third line contains nn integers separated by spaces y1,y2,…,yny1,y2,…,yn, the number of stones in piles recorded in the notebook when the participants came to the place with stones for the second time (0≤yi≤10000≤yi≤1000).

Output

If the records can be consistent output "Yes", otherwise output "No" (quotes for clarity).

Examples

input

Copy

5
1 2 3 4 5
2 1 4 3 5

output

Copy

Yes

input

Copy

5
1 1 1 1 1
1 0 1 0 1

output

Copy

Yes

input

Copy

3
2 3 9
1 7 9

output

Copy

No

水题直接上代码,不要多想这个题

代码:

#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int a[108],b[108],a1,b1;
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
          cin>>a[i];
          a1+=a[i];
    }

    for(int i=1;i<=n;i++)
    {
            cin>>b[i];
            b1+=b[i];
    }
    if(b1-a1<=2&&b1<=a1) printf("Yes\n");
    else printf("No\n");
    return 0;

}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

不会敲代码的小帅

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值