본문 바로가기

Solutions/Dlbo's Solution

PKU 3364. Black and white painting. AC get~

#include 

using namespace std;

int main()
{
	int n, m, c;

	while(cin >> n >> m >> c)
	{
		if (n == 0 && m == 0 && c == 0)
		{
			break;
		}

		if(n < 8 || m < 8)
		{
			cout << 0 << endl;
			continue;
		}

		if(n % 2 != 0 || m % 2 != 0)
		{
			if (c >= 1)
			{
				cout << (m - 7) * (n - 7) / 2 << endl;
				continue;
			}
			else
			{
				cout << (m - 7) * (n - 7) / 2 << endl;
				continue;
			}
		}
		else
		{
			if(c >= 1)
			{
				cout << (m - 8) * (n - 8) / 2 + 1 + (n - 8) / 2 + (m - 8) / 2 << endl;
				continue;
			}
			else
			{
				cout << (n - 8) * (m - 8) / 2 + (n - 8) / 2 + (m - 8) / 2 << endl;
			}
		}
	}
}



부어어어어

귀차니즘.