Competitive/Collaborative Programming Class

ICPC Computer Programming Contest Prep

Problem Solving in Computer Science

Fall 2011 -- CSC 2700 Section 02

[Isaac's Home Page ]  [Mailing List ]  [Class Page ]  [Normal ]  

12/i/11854CM.cpp

/*
Chris McKnight
UVA 11854: Egypt
11/9/11
*/

#include <iostream>

#define DEBUG if(false)
const char results[2][6] = {"right", "wrong"};

using namespace std;

int main(int argc, char* argv[])
{
	int a,
		b,
		c;
		
	cin >> a >> b >> c;
	while (a && b && c)
	{
		DEBUG cout << "a = " << a << " b = " << b << " c = " << c << endl;
		if (( (a*a) + (b*b) == (c*c) ) || (a*a) + (c*c) == (b*b) || (c*c) + (b*b) == (a*a) )
			cout << results[0] << endl;
		else
			cout << results[1] << endl;
		
		cin >> a >> b >> c;
	}
	return 0;
}

The statements and opinions included in these pages are those of only. Any statements and opinions included in these pages are not those of Louisiana State University or the LSU Board of Supervisors.
© 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Isaac Traxler