DEV Community

Ibrahim
Ibrahim

Posted on

Day 2

https://codeforces.com/problemset/problem/1480/B

I solved this without AI and web

Code:

include

include

include

include

using namespace std;

int main() {
srand(time(0));
int A, B, n, c =0, z =0;
cin>>A>>B>>n;

int a[n], b[n];
for(int i = 0; i < n; i++){
    cin>>a[i];
}
for(int i = 0; i < n; i++){
    cin>>b[i];
}
for(int i = 0; i < n; i++){
    int x = rand() % (0 - n);
    while(1>0 == true){
        B = B - a[x];
        b[x] = b[x]-A;
        if(b[x]<=0){z++; break;}
        if((B <= 0)){break;}
    }
    if(z == n){ cout<<"Yes";}
    if((B <= 0)&&(z!=n)){ cout<<"NO"; break;}
}

return 0;
Enter fullscreen mode Exit fullscreen mode

}

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up