U E D R , A S I H C RSS

2thPCinCAUCSE/ProblemA/Solution/상욱

~cpp 
#include <iostream>
using namespace std;

class Aaa {
private:
	int testCase;
	int inputNumber;
	int count;
public:
	Aaa() {
		cin >> testCase;
		count = 0;
	}

	void run() {
		for (int test = 0 ; test < testCase ; test++)
		{
			count = 0;
			input();
			calculate();
			output();
		}
	}

	void input() {
		cin >> inputNumber;
	}

	void calculate() {
		for (int i = 1 ; i <= inputNumber-2 ; i++)
		{
			for (int j = i ; j <= inputNumber-i-1 ; j++)
			{
				int k = inputNumber-i-j;
				if ( k < j ) {
					continue;
				} else if ( i+j <= k || i+k <= j || j+k <= i) {
					continue;
				} else {
					count++;
				}
			}
		}
	}

	void output() {
		cout << count << endl;
	}
};

int main()
{
	Aaa aaa;
	aaa.run();
	return 0;
}

Thread


  • 입력 방법을 잘못 알아서 3번 틀렸답니다...ㅠ.ㅠ 원래 다 맞았었는데.. (그러면 3등이었건만...ㅠ.ㅠ) -상욱

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:14
Processing time 0.0079 sec