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 注:题面参考了网上的其他博客,并非原题题面,因此数据范围可能有误.数据为原创数据. 题解 其实就是许 ...
随机推荐
- Discuz X2.5 用户名包含被系统屏蔽的字符[解决方法]
/uc_client/data/cache/badwords.php文件里的内容 删除并用 utf-8格式保存
- Android 网络框架---Volley
/** * Volley 可以同时请求多个,允许高并发 * 特性: * 1.JSON.图片等的异步下载 * 2.网络请求的排序(Scheduling) * 3.网络请求的优先级处理 * 4.缓存 * ...
- C#中MessageBox使用方法大全(附效果图)
我们在程序中常常会用到MessageBox. MessageBox.Show()共同拥有21中重载方法.现将其常见使用方法总结例如以下: 1.MessageBox.Show("Hello~~ ...
- HDFS Architecture--官方文档
HDFS Architecture Introduction The Hadoop Distributed File System (HDFS) is a distributed file syste ...
- SPOJ 3048 - DNA Sequences LCS
给出两个字符串(不长于1000),求最长公共子序列,要求:从每个串中取必须取连续k (1<=k<=100)个数 [LCS]一开始自己想用DP加一维[len]用来表示当前已经取了连续len个 ...
- python字符串replace()方法
python字符串replace()方法 >>> help(str.replace)Help on method_descriptor:replace(...) S.repla ...
- 转载:C#中&与&&的区别
原文地址:http://www.cnblogs.com/chinafine/archive/2009/02/17/1392309.html 感谢博主分享! 二元运算符 (&) 为整型和 b ...
- 关于asp.net C# 导出Excel文件 打开Excel文件格式与扩展名指定格式不一致的解决办法
-----转载:http://blog.csdn.net/sgear/article/details/7663502 关于asp.net C# 导出Excel文件 打开Excel文件格式与扩展名指定格 ...
- OC - 21.CALayer核心要点及实例解析
CALayer基础 CALayer是每一个UI控件的核心,一个UI控件之所以能显示可以说是CALayer的功劳 每一个UI控件默认都为自己创建一个CALayer对象,通过drawRect方法将内容绘制 ...
- poi大数据将excel2007导入数据库
package com.jeeframe.cms.updata.service.impl; import java.io.IOException; import java.io.InputStream ...