博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 C: Coconut
阅读量:5356 次
发布时间:2019-06-15

本文共 1390 字,大约阅读时间需要 4 分钟。

C: Coconut

time limit

200ms

memory limit

131072KB

Coconut is Captain Gangplank's favourite fruit. That is why he needs to drink coconut juice from b coconuts each day.

On his next trip, he would pass through N citis.

His trip would begin in the 1-st city and end in the N-th city.

The journey from the i-th city to the (i + 1)-th city costs Di days.

Initially, there is no coconut on his ship. Fortunately, he could get supply of Ci coconuts from the i-th city.

Could you tell him, whether he could drink coconut juice every day during the trip no not 

Input Format

The first line contains an integer T , indicating that there are T test cases.

For each test case the first line contains two integers N and b as described above. 

The second line contains N integers C1, C2,  , CN .

The third line contains N − 1 integers D1, D2,  , DN−1.

All integers in the input are less than 1000.

Output Format

For each case, output Yes if Captain Gangplank could drink coconut juice every day, and otherwise output No.

Sample Input

2

4 1

3 2 1 4

1 2 3

4 2

2 4 6 8

3 2 1

Sample Output

Yes

No

#include 
using namespace std;int main(){ int a[2][1000]; int n,t,b; cin>>t; while(t--) { cin>>n>>b; for(int i=0;i
>a[0][i]; for(int i=0;i
>a[1][i]; for(int i=0;i

转载于:https://www.cnblogs.com/sxy201658506207/p/7586277.html

你可能感兴趣的文章
java小程序100例
查看>>
利用二维数组实现以下由星号组成的棱形图形的输出。
查看>>
正式入驻博客园
查看>>
PHP高手干货分享:不能不看的50个细节!
查看>>
How to do if the GM MDI cant connect with the software
查看>>
暑假集训之专题----拓扑排序题解
查看>>
Java中快速排序的实现
查看>>
uva 11039
查看>>
防雪崩利器:熔断器 Hystrix 的原理与使用
查看>>
JQuery EasyUI 之 DataGrid
查看>>
未名湖畔的烦恼
查看>>
.NET开发的大型网站列表、各大公司.NET职位精选,C#王者归来
查看>>
error C2039: 'SetDefaultDllDirectories'错误解决办法
查看>>
Git学习渠道
查看>>
理解Redux以及如何在项目中的使用
查看>>
实验三 敏捷开发与XP实践
查看>>
RAC的搭建(三)--Grid的安装
查看>>
oracle存储过程一(返回单条记录的值)
查看>>
vue+node+mongoDB火车票H5(七)-- nodejs 爬12306查票接口
查看>>
Java的位运算符详解实例——与(&)、非(~)、或(|)、异或(^)
查看>>