Thursday, 7 September 2017

Uva Problem 11936 - The Lazy Lumberjacks Solution (C++)

Problem:

11936 - The Lazy Lumberjacks


Please find the problem here.

Solution:

This is the simplest problem I ever had, just implement the given formulas! However, it does take me some time to write.

Code:


#include <bits/stdc++.h>
using namespace std;
int main(){
int t;
int x,y,z;
cin>>t;
while(t--){
cin>>x>>y>>z;
if(x+y>z && y+z>x && z+x>y){
cout<<"OK"<<endl;
}
else if(x==y && y ==z && z==x)
    cout<<"OK"<<endl;
else cout<<"Wrong!!"<<endl;
}

return 0;}

No comments:

Post a Comment

Spoj Problem ACMCEG2C - Pick the candies (C++)

  The problem link may be found here.       Explanation: Use Deque to keep track of elements of the variety of candies. If i is gre...