2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 C. Coconut(签到)

                                    C: Coconut
                    time limit 200ms   memory limit 131072KB

Discussion

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 D days.
Initially, there is no coconut on his ship. Fortunately, he could get supply of C coconuts
from the i-th city.
Could you tell him, whether he could drink coconut juice every day during the trip no
not?
i
i

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 C , C ,⋯, C .
The third line contains N − 1 integers D , D ,⋯, D .
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

题意

一个人不带饮料出门却要喝饮料
每天合Di瓶
每个城市获得Ci瓶
他能走完全程吗

思路

模拟?

代码

#include 
#include 
#include 
using namespace std;
int main()
{
    int t,i,n,b;
    int c[1005];
    int d[1005];
    scanf("%d",&t);
    while(t--)
    {
        int cur=0;
        scanf("%d%d",&n,&b);
        for(i=0;iscanf("%d",&c[i]);
        for(i=0;i1;i++)
            scanf("%d",&d[i]);
        d[i]=0;
        for(i=0;iif(cur<0)
                break;
        }
        if(i==n)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}

你可能感兴趣的:(比赛)