uva 10790 How Many Points of Intersection?(数学)
来源:互联网 发布:百度seo 价格 编辑:程序博客网 时间:2024/06/05 09:48
题意:
给定上下两条线分别有多少个点 ,之后求直线相交之后的交点数目,注意线上面的交点是不算的。
思路:
找规律,先画好上面的a个点,
画下面第一个点:它与上面所有点连线后没有交点。
画下面第二个点:它与a1连线后交点为a-1,与a2连线交点为a-2,........ 与最后一个点连线交点为0;
画下面第三给点:它与a1连线后交点为2*(a-1),与a2连线交点为1(a-2)......与最后一个交点连线交点为0;
以此类推。
注意:上下两条线上面的点的排序是没有等间距的,等间距会导致交点变少。
#include<iostream>#include<cstdio> using namespace std;int main (){long long m,n;int co=1;while(scanf("%lld %lld",&m,&n)&&m&&n){printf("Case %d: ",co++);printf("%lld\n",m*(m-1)*n*(n-1)/4);}return 0;}
阅读全文
0 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?
- 一个点击的行 上升/下降(类似mysql的改变表可以调整字段位置功能) 需求开发记录
- 关于tomcat首页打不开部署项目能打开的问题解决方法
- opencv8-图像分割-分水岭算法
- 选择困难
- 实现守护进程
- uva 10790 How Many Points of Intersection?(数学)
- 搜索百度云资源的一点小技巧
- 关于sql语句的优化
- 检测环境中是否有core文件并自动发送邮件通知
- 安装opencv 在ubuntu14.04
- javascript中线程和定时器的理解
- Kafka温故而知新之初识
- Alamofire源码解读系列(三)之通知处理(Notification)
- Matlab中cell2mat,num2cell函数