ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 2142. Magic

wa 3
Posted by Simen 30 Nov 2019 23:25
whats problem on test 3??
что за проблема на 3 тесте??
Re: wa 3
Posted by __Andrewy__ 1 Dec 2019 22:45
Yep
Why my code get WA3?
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;

#define ll long long

const ll nmax = 100005;
const ll inf = 1234567890123;

ll A, B, C;
ll X, Y, Z;

int main()
{
   cin>>A>>B>>C;
   cin>>X>>Y>>Z;

    if(Z > C)
        cout<<"There are no miracles in life";
    else
    {
        ll ess = (ll)0;
        if(X > A) ess += X - A;
        if(Y > B) ess += Y - B;
        if(C - Z >= ess)
            cout<<"It is a kind of magic";
        else
            cout<<"There are no miracles in life";
    }


   return 0;
}


or more simple

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;

#define ll long long

const ll nmax = 100005;
const ll inf = 1234567890123;

ll A, B, C;
ll X, Y, Z;

int main()
{
   cin>>A>>B>>C;
   cin>>X>>Y>>Z;

   if(X > A)
        C -= (X - A);
   if(Y > B)
        C -= (Y - B);
   if(Z <= C)
        cout<<"It is a kind of magic";
   else
        cout<<"There are no miracles in life";

   return 0;
}