pku1809.cpp
来自「这是ACM 方面的资料 是PKU的 北京大学的出来的」· C++ 代码 · 共 43 行
CPP
43 行
#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;
typedef long long LLN;
LLN ans[4];
void Solve()
{
int N, i, x, y;
LLN mul, res, tmp;
scanf("%d", &N);
memset(ans, 0, sizeof(ans));
for (i = 0; i < N; i++)
{
scanf("%d %d", &x, &y);
x = x % 2 ? 1 : 0;
y = y % 2 ? 1 : 0;
ans[x * 2 + y]++;
}
mul = ans[1] * ans[2] * ans[3] + ans[0] * ans[2] * ans[3] +
ans[0] * ans[1] * ans[3] + ans[0] * ans[1] * ans[2];
tmp = N;
res = tmp * (tmp - 1) * (tmp - 2) / 6;
res -= mul;
cout<<res<<endl<<endl;
}
int main()
{
int T, t;
scanf("%d", &T);
for (t = 1; t <= T; t++)
{
printf("Scenario #%d:\n", t);
Solve();
}
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?