1366 - Pair of Touching Circles   PDF (English) Statistics Forum Time Limit: 3 second(s) Memory Limit: 32 MB You are given a rectangular grid of height H and width W. A problem setter wants to draw a pair of circles inside the rectangle so that they…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1366 题意:给出一个矩形,在内部画两个圆A和B使得AB都完全在矩形内且AB相切且AB的圆心和半径都是整数.求有多少个这样的画法? 思路:总的来说,相切有两种情况:(1)水平或垂直方向相切.这个比较简单,枚举两个圆的直径,然后分水平垂直两种情况,计算较小的那个圆可以移动的范围,其实可以移动的范围是一个矩形:(2)斜着相切.这时候两个圆心的距离必然是一个勾股数.所以枚举勾股数,然后再枚举…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1366 题意:一个H*W的矩形,现在要放入两个外切的圆,问能放多少对这样的圆,其中圆心和半径都是整数: 枚举相对的圆心坐标,根据圆心的距离,再枚举一个圆的半径: #include<stdio.h> #include<iostream> #include<string.h> #include<algorithm> #include<cmath&…
思路:(注意2个圆的半径可以不一样) 有2种情况: 1) 水平和竖直放.这种情况很简单,刚开始以为只有这种情况,但是样例5不对,后来知道还有一种情况. 2)斜线也可以放.只要满足勾股数就可以.现在的问题是怎样确定包含2个圆的矩形,可以通过枚举一个圆的半径 来确定. 代码如下: #include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #include<cstring&…
题目链接:https://vjudge.net/contest/28079#problem/R 题目大意:给你分别给你两个日期(第二个日期大于等于第一个日期),闰年的2月29日称为闰日,让你求两个日期之间的闰日数量. 解题思路:①先求闰年数量,可以根据容斥原理,得到ans=(year2/4-year1/4)-(year2/100-year1/100)+(year2/400-year1/400) ②根据year1和year2的月份特判该年是否含闰日,注意一下上面的算式中ans包含了year2而没有…
Dhaka2011 A - Binary Matrix 题目描述:有一个\(n \times m\)的\(01\)矩阵,这一矩阵第一行和最后一行是相邻的,第一列和最后一列是相邻的,现在每次可以交换相邻的两个位置的数(四相邻),问最少多少次操作使得每一行的\(1\)的个数相同,每一列的\(1\)的个数相同,如果不行,则最少多少次操作使得每一行的\(1\)的个数相同,如果不行,则最少多少次操作使得每一列的\(1\)的个数相同,如果不行,则输出无解. solution 行和列是独立的,因此可以分开做,…
要back的题目 目标是全绿!back一题删一题! acmm7 1003 1004 acmm8 1003 1004 sysu20181013 Stat Origin Title Solved A Gym 100624A Kingdoms   B Gym 100624B Who wants to live forever? Solved C Gym 100624C Chemist's vows   D Gym 100624D Non-boring sequences Attempted E Gym…
Spark学习笔记1--第一个Spark程序:单词数统计 笔记摘抄自 [美] Holden Karau 等著的<Spark快速大数据分析> 添加依赖 通过 Maven 添加 Spark-core_2.10 的依赖 程序 找了一篇注释比较清楚的博客代码1,一次运行通过 import scala.Tuple2; import org.apache.spark.SparkConf; import org.apache.spark.api.java.JavaPairRDD; import org.ap…
D. Looking for Owls Emperor Palpatine loves owls very much. The emperor has some blueprints with the new Death Star, the blueprints contain n distinct segments and m distinct circles. We will consider the segments indexed from 1 to n in some way and…
传送门 A - A+...+B Problem 题意:n个数最大值a,最小值b,求和的可能数量. #include<cstdio> #include<algorithm> using namespace std; int read_p,read_ca; inline int read(){ read_p=;read_ca=getchar(); ') read_ca=getchar(); +read_ca-,read_ca=getchar(); return read_p; } in…