社区讨论

求查错

P7471[NOI Online 2021 入门组] 切蛋糕参与者 2已保存回复 1

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
1 条
当前快照
1 份
快照标识符
@lochsx46
此快照首次捕获于
2023/10/30 14:01
2 年前
此快照最后确认于
2023/11/05 01:28
2 年前
查看原帖
CPP
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int T, t[4];

int cmp (int x, int y) {
	return x > y;
}

int main () {
//	freopen ("cake.in", "r", stdin);
//	freopen ("cake.out", "w", stdout);
	scanf ("%d", &T);
	while (T --) {
		scanf ("%d%d%d", &t[1], &t[2], &t[3]);
		sort (t + 1, t + 1 + 3, cmp);
		int a = t[1], b = t[2], c = t[3];
		if (b == c && c == 0) printf ("0\n");
		else if (c == 0) {
			if (a == b) printf ("1\n");
			else printf ("2\n");
		}
		else {
			int s = a + b + c;
			a = 360 / s * a;
			b = 360 / s * b;
			c = 360 / s * c;
			if (a > 180) {
				if (b == c) printf ("2\n");
				printf ("3\n");
			}
			else if (a == 180) printf ("2\n");
			else {
				if (b == c) printf ("2\n");
				else printf ("3\n");
			}
		}
	}
	return 0;
}
/*
6
0 0 8
0 5 3
9 9 0
6 2 4
1 7 4
5 8 5
*/

回复

1 条回复,欢迎继续交流。

正在加载回复...