ECJAN20A - Editorial

PROBLEM LINK:

Practice
Encoding January’20 Contest

Author: shrivas7
Tester: nuttela
Editorialist: shrivas7

DIFFICULTY:

Cakewalk

PREREQUISITES:

Properties of Triangles

EXPLANATION:

Two conditions to be checked for are:

  1. All the three angles are greater than 0.
    2.Sum of three of them should be equal to 180.

SOLUTIONS:

Setter's Solution

#include <bits/stdc++.h>
using namespace std;

int main() {
long long t,a,b,c;
cin>>t;
while(t–)
{
cin>>a>>b>>c;
if((a>0)&&(b>0)&&(c>0)&&(a+b+c==180))
cout<<“YES”<<endl;
else
cout<<“NO”<<endl;
}
return 0;
}

Tester's Solution

#include <bits/stdc++.h>

using namespace std;

#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ff first
#define ss second

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;

const int N = 1e6+6;
const int inf = INT_MAX;
const ll MOD = 1e9 + 7;

/typedef struct data
{
data
bit[2];
int cnt = 0;
} trie;

trie* head;

void insert(int x){

trie* curr = head;
for (int i = 30; i >= 0; --i)
{
int b = (x>>i)&1;
cout << bit << endl;
if(!curr->bit[b]){
curr->bit[b] = new trie();
}
curr = curr->bit[b];
curr->cnt++;
}
}*/

int main() {
IO;
int t;cin>>t;
while(t–){
ll a,b,c;cin>>a>>b>>c;
if(a==0||b==0||c==0)cout<<“NO”;
else cout<<(a+b+c==180?“YES”:“NO”);
cout<<endl;
}

return 0;
}

1 Like