10790 - How Many Points of Intersection?
2012-10-13 21:36
274 查看
很久不做题了,做也做水题,做水题也做不出,想很久没想出来,看了一下别人的blog,
可以这么想,要产生一个交点至少要上下各两个点,这样答案出来了,上面有(a-1)*a/2种,同理下面也是,这样就得到答案了
可以这么想,要产生一个交点至少要上下各两个点,这样答案出来了,上面有(a-1)*a/2种,同理下面也是,这样就得到答案了
#include <cstdio> #include <iostream> using namespace std; int main ( int argc, char *argv[] ) { freopen("data","r",stdin); long long int a,b; int Case = 1; while(scanf("%lld %lld",&a,&b)){ if(a+b == 0) { break; } cout<<"Case "<<Case++<<": "; cout<<((a-1)*a*(b-1)*b)/4<<endl; } return 0; } /* ---------- end of function main ---------- */
相关文章推荐
- 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?(组合数学)
- 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?
- 10790 - How Many Points of Intersection?
- UVA 10790 - How Many Points of Intersection?
- uva 10790 How Many Points of Intersection?
- UVA 10790 (暑假-数学(3)-A - 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?