How Many Points of Intersection?
uva10790:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1731
题意:两条水平线,分别有n,m个点,点之间两两连线,求有多少个交点。
题解:手动模拟一下,然后用不完全归纳法,就可以得到公式ans=(n-1)*n/2*(m-1)*m/2;
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
long long m, n;
int main(){
int tt=;
while(~scanf("%lld%lld",&n,&m)){
if(n==&&m==)break;
printf("Case %d: %lld\n",tt++,(n-)*n/*(m-)*(m)/);
}
}
How Many Points of Intersection?的更多相关文章
- UVA 10790 How Many Points of Intersection?
How Many Points of Intersection? We have two rows. There are a dots on the top row and b dots on ...
- UVA 10790 How Many Points of Intersection? 组合数学
We have two rows. There are a dots on the top row and b dots on the bottom row. We draw line segment ...
- Coursera Robotics系列课心得
Robotics Perception Professor Kostas and Jianbo Shi week 1: camera model 凸透镜成像原理:凸透镜焦点与焦距是固定的,这是物理性质 ...
- UVA题目分类
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...
- [算法]A General Polygon Clipping Library
A General Polygon Clipping Library Version 2.32 http://www.cs.man.ac.uk/~toby/alan/software/gpc.h ...
- [非官方]ArcGIS10.2 for Desktop扩展工具包——XTools Pro
XTools Pro 是一套为ArcGIS平台设计的矢量空间分析. 形状转换和表管理扩展工具,大大增强了 ArcGIS 的功能,使用该工具能够提高 ArcGIS 用户的效率和性能. XTools Pr ...
- Circles and Pi
Circles and Pi Introduction id: intro-1 For as long as human beings exist, we have looked to the sky ...
- UVA 10790 (13.08.06)
How Many Points of Intersection? We have two rows. There are a dots on the toprow andb dots on the ...
- [SCOI2018]游泳池(计算几何+分数规划+最大权闭合子图)
题目链接 https://www.luogu.org/problemnew/show/U56187 注:题面参考了网上的其他博客,并非原题题面,因此数据范围可能有误.数据为原创数据. 题解 其实就是许 ...
随机推荐
- zookeeper 集群 Cannot open channel to X at election address Error contacting service. It is probably not running.
zookeeper集群 启动 1.问题现象. 启动每一个都提示 STARTED 但是查看 status时全部节点都报错 [root@ip-172-31-19-246 bin]# sh zkSer ...
- linux防火墙 基础知识
转 http://drops.wooyun.org/tips/1424 iptables介绍 linux的包过滤功能,即linux防火墙,它由netfilter 和 iptables 两个组件组成. ...
- 遭遇多线程bug (1)
某些用户,机器重启后,到第三方服务器的连接起不来,而到我们自己服务器的连接就没事. 如果连接由于网络或其他原因fail掉,过一定时间后应该会重新尝试建立连接的. 测试组做初步调查,他们能在本地环境复现 ...
- 你好,C++(12)怎样管理多个类型同样性质同样的数据?3.6 数组
3.6 数组 学过前面的基本数据类型之后,我们如今能够定义单个变量来表示单个的数据.比如,我们能够用int类型定义变量来表示公交车的216路:能够用float类型定义变量来表示西红柿3.5元一斤. ...
- QT程序库
实际上,QT不仅仅是一个巨大的程序库,而是7个程序库,还包括许多使用工具,qmake是其中的一个.如今,术语GUI工具包代表的东西的用途不再仅仅是系统提供的那么一个小部分(GUI界面).尤其是QT ...
- python摇骰子猜大小的小游戏
#小游戏,摇筛子押大小的小游戏玩家初始有1000块钱,可以压大压小作为赌注 import random #定义摇筛子的函数: def roll_dice(number = 3,points = Non ...
- Nginx反向代理,负载均衡配置
主配置文件:nginx.conf # For more information on configuration, see: # * Official English Documentation: h ...
- html.day02
1.链接标签 a <a href=”http://www.baidu.com”></a> <img src=”aaa”/> 一般情况下: 来源 用 src ...
- java中判断两个字符串是否相等的问题
我最近刚学java,今天编程的时候就遇到一个棘手的问题,就是关于判断两个字符串是否相等的问题.在编程中,通常比较两个字符串是否相同的表达式是“==”,但在java中不能这么写.在java中,用的是eq ...
- php 写model层
<?php /** * @author Administrator * */ class User { private $id; private $admin; private $paw; pr ...