10790 - How Many Points of Intersection?

来源:互联网 发布:2016年非农数据统计 编辑:程序博客网 时间:2024/06/06 10:55

题目:10790 - How Many Points of Intersection?


题目大意:求上下的点两两连成直线的交点个数。

公式:(m-1)*m*(n-1)*n/4;注意:数值相乘会很大,用int不够。

#include<stdio.h>int m, n, i ;int main() {i = 0;while(scanf("%d %d", &m, &n) != EOF && m && n) {i++; printf("Case %d: %ld\n", i, (long long)(n - 1)* n * m * (m - 1)/4);}return 0;}


0 0