uva 10790 How Many Points of Intersection?
2013-09-26 16:31
337 查看
假设上面和下面分别有m个点和n个点,可以推导出最多的交点个数为m*n*(m-1)*(n-1) / 4. 这样程序就非常简单了。
#include <stdio.h> int case_count; long long func(int m, int n) { return (long long)(m)*(long long)(n)*(long long)(m-1)*(long long)(n-1) / 4; } int main(void) { int m, n; case_count = 0; while(1) { scanf("%d %d", &m, &n); if(!m && !n) break; case_count ++; printf("Case %d: %lld\n", case_count, func(m,n)); } return 0; }
相关文章推荐
- Uva 10790 - How Many Points of Intersection?
- UVa 10790 - How Many Points of Intersection?
- UVA - 10790 How Many Points of Intersection?
- uva-10790-How Many Points of Intersection?
- UVA 10790 How Many Points of Intersection? 简单数学题
- UVA 10790-How Many Points of Intersection?#
- UVa 10790 - How Many Points of Intersection?
- uva 10790 - How Many Points of Intersection?
- UVa 10790 - How Many Points of Intersection?
- UVA-10790 How Many Points of Intersection?
- Uva 10790 - How Many Points of Intersection?
- uva 10790 How Many Points of Intersection?(几何规律)
- uva 10790 How Many Points of Intersection?(数学)
- UVA 10790 How Many Points of Intersection?
- uva 10790 - How Many Points of Intersection?
- uva 10790 - How Many Points of Intersection?
- Uva 10790 How Many Points of Intersection?
- uva 10790 How Many Points of Intersection?
- uva - 10790 - How Many Points of Intersection?
- UVA 10790 How Many Points of Intersection?