NABILISU - Billing Issue Editorial or Solution SPOJ - UCS - Unleash-Coding-Skills

Tuesday, 24 July 2018

NABILISU - Billing Issue Editorial or Solution SPOJ - UCS




NABILISU - Billing Issue


The link to the problem NABILISU - Billing Issue in spoj is:


Explanation:


1) Muzahid always gives the waiter tips at least 1 taka : So if the tip given by Muzahid is '0' (i.e k=0 as per given input format) The answer is 'NO' for that case.At the same time if incase the Bill made Muzahid (i.e 'b') is greater or equal to Nabil(i.e 'a' as per input).Then its answer is also 'NO' since he can't give any tip since his bill is greater than or equal to Nabil(i.e a>=b results answer 'NO').
2) If Tip(i.e 'k') +Muzahid bill(i.e 'a') <  Nabil's Bill(i.e, 'b') then the answer for that case is 'NO' for remaining all things the answer is 'YES'.

The CPP solution for the NABILISU - Billing Issue in spoj is:


#include <iostream>
using namespace std;


int main() {
   int a,b,k,t;
    string ans;
    cin>>t;
    for(int i=1;i<=t;i++)
    {
        cin>>a>>b>>k;
        if(k==0||b>=a)
        {
 cout<<"Case "<<i<<": NO"<<endl;
            continue;
        }
        
        if(k+b>=a)
            ans = ": YES";
            else
                ans=": NO";
        cout<<"Case "<<i<<ans<<endl;
    }
    return 0;
}

Happy Coding.....

Tags:

NABILISU - Billing Issue Editorial or Solution SPOJ Editorial,NABILISU - Billing Issue Editorial or Solution SPOJ Solution SPOJ,SPOJ solution,NABILISU - Billing Issue Editorial or Solution SPOJ answer, nabilisu - billing isssue editorial,  nabilisu solution, nailisu problem spoj , adhoc solution, nabilisu - billing issue cpp solution.



No comments:

Post a comment