您的位置:首页 > 其它

10790 - How Many Points of Intersection?

2012-10-13 21:36 274 查看
很久不做题了,做也做水题,做水题也做不出,想很久没想出来,看了一下别人的blog,

可以这么想,要产生一个交点至少要上下各两个点,这样答案出来了,上面有(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  ---------- */
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: