8 UVA 10790 How Many Points of Intersection?

第一排第i个点和第二排第j个点相连,在这条线段上会产生(a-i)*(j-1)个交点,

以此类推,推公式即可。

#include<cstdio>#define ll long longll a,b;int cas=1;int main(){while(~scanf("%d%d",&a,&b)&&(a||b))printf("Case %d: %lld\n",cas++,a*(a-1)/2*b*(b-1)/2);return 0;}

,所有的失败,与失去自己的失败比起来,更是微不足道

8 UVA 10790 How Many Points of Intersection?

相关文章:

你感兴趣的文章:

标签云: