Created
August 8, 2018 18:36
-
-
Save lawrencefmm/391b194ba6b28db8044deb9a11085fbf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// By Lawrence Melo | |
// https://szkopul.edu.pl/problemset/problem/tX0rS-7EjatV5bZ8pmijgiHZ/site/?key=statement | |
#include <bits/stdc++.h> | |
using namespace std; | |
vector<int> ans; | |
bool is_triangle(int a, int b, int c) | |
{ | |
bool ok1 = false,ok2 = false,ok3 = false; | |
if(a + b > c) ok1 = true; | |
if(a + c > b) ok2 = true; | |
if(b + c > a) ok3 = true; | |
if(ok1 and ok2 and ok3) return true; | |
return false; | |
} | |
int main() | |
{ | |
ios::sync_with_stdio(false), cin.tie(nullptr); | |
int a; | |
int cont = 0; | |
while(cin >> a) | |
{ | |
cont++; | |
if(a == 0) break; | |
ans.push_back(a); | |
} | |
int t = min(cont, 45); | |
for(int i = 0; i < t - 2; i++) | |
{ | |
for(int j = i + 1; j < t - 1; j++) | |
{ | |
for(int z = j + 1; z < t; z++) | |
{ | |
if(is_triangle(ans[i], ans[j], ans[z])) | |
{ | |
cout << ans[i] << " " << ans[j] << " " << ans[z] << "\n"; | |
return 0; | |
} | |
} | |
} | |
} | |
cout << "NIE\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment