?? pku1809.cpp
字號:
#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;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -