Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Y WA?把点分成四种类型,分别统计数目,结果应该是n个点中取3个的方法书减去不符合要求的构成。 大牛们能否百忙之中告知是哪儿错了? //pku1809 // #include<stdio.h> int main() { // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); int tt, ii, i; __int64 n; int x, y; int a, b, c, d; scanf("%d", &tt); for(ii = 1; ii <= tt; ii++) { a = b = c = d = 0; scanf("%I64d", &n); for(i = 0; i < n; i++) { scanf("%d%d", &x, &y); if(x%2!=0) { if(y%2!=0) d++; else c++; } else { if(y%2) b++; else a++; } } __int64 res = n*(n-1)*(n-2)/6; res -= (a*b*c+a*b*d+a*c*d+b*c*d); printf("Scenario #%d:\n", ii); printf("%I64d\n\n", res); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator