[USACO12FEB]Symmetry】的更多相关文章

传送门: https://www.luogu.com.cn/problem/P3046 https://ac.nowcoder.com/acm/contest/6306/G 题意 给定n个不同的点,求这个点集有多少条对称轴 题解 对于一个点只有两种情况,一种是和另一个点关于这条线对称,一种是在对称轴上. 第一种情况:随机选择一个点p,枚举其他的点和他形成的对称轴,然后再判断这个对称轴是不是点集的对称轴. 第二种情况:当点在对称轴上时,要么另一个点 q 也在对称轴上,两点所在的直线是对称轴,这种情…
Description After taking a modern art class, Farmer John has become interested in finding geometric patterns in everything around his farm. He carefully plots the locations of his N cows (2 <= N <= 1000), each one occupying a distinct point in the 2…
Symmetry Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Description   The figure shown on the left is left-right symmetric as it is possible to fold the sheet of paper along a vertical line, drawn as a dashed line, and to cut…
题目链接:fzu 2035 Axial symmetry 题目大意:给出n个点,表示n边形的n个顶点,判断该n边形是否为轴对称图形.(给出点按照图形的顺时针或逆时针给出. 解题思路:将相邻两个点的中点有序的加入点集,即保证点是按照图形的顺时针或逆时针出现的,然后枚举i和i + n两点的直线作为对称轴.判断其他所有点是否对称即可. #include <stdio.h> #include <string.h> #include <stdlib.h> #include <…
题意:平面上给若干点,问它们是不是关于某垂直于x轴的直线对称. 代码:(Wrong Answer, –ms) //UVa1595 - Symmetry #include<iostream> #include<vector> #include<algorithm> using namespace std; struct point { int x, y; bool operator <(point& that)const { if (y == that.y)…
针对对称性PDB 3UKM,使用make_symmdef_file.pl脚本,可以执行产生对称单元及对称文件: $> $ROSETTA3/src/apps/public/symmetry/make_symmdef_file.pl -m NCS -a A -i B -p 3UKM.pdb > 3UKM.symm 参数意义: Here we are using symmetry to model an already-symmetric starting protein. This is call…
P3048 [USACO12FEB]牛的IDCow IDs 12通过 67提交 题目提供者lin_toto 标签USACO2012 难度普及/提高- 时空限制1s / 128MB 提交  讨论  题解 最新讨论更多讨论 谁能解释一下这个样例啊.... 题目描述 Being a secret computer geek, Farmer John labels all of his cows with binary numbers. However, he is a bit superstitiou…
A. Clear Symmetry 题目连接: http://codeforces.com/contest/201/problem/A Description Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from l…
P3047 [USACO12FEB]附近的牛Nearby Cows 农民约翰已经注意到他的奶牛经常在附近的田野之间移动.考虑到这一点,他想在每一块土地上种上足够的草,不仅是为了最初在这片土地上的奶牛,而且是为了从附近的田地里去吃草的奶牛. 具体来说,FJ的农场由N块田野构成(1 <= n <= 100,000),每两块田野之间有一条无向边连接(总共n-1条边).FJ设计了农场,任何两个田野i和j之间,有且只有一条路径连接i和j.第 i块田野是C(i)头牛的住所,尽管奶牛们有时会通过k条路到达其…
P3045 [USACO12FEB]牛券Cow Coupons 71通过 248提交 题目提供者洛谷OnlineJudge 标签USACO2012云端 难度提高+/省选- 时空限制1s / 128MB 提交  讨论  题解 最新讨论更多讨论 86分求救 题目描述 Farmer John needs new cows! There are N cows for sale (1 <= N <= 50,000), and FJ has to spend no more than his budget…
The main reasons why hydraulic motors have this symmetrical internal structure are as follows: The     Hydraulic Motor manufacturers    states: 1. Because this product is in use, it needs to be able to achieve forward and reverse. In order to achieve…
P3047 [USACO12FEB]附近的牛Nearby Cows 题目描述 Farmer John has noticed that his cows often move between nearby fields. Taking this into account, he wants to plant enough grass in each of his fields not only for the cows situated initially in that field, but…
P3047 [USACO12FEB]附近的牛Nearby Cows 题目描述 Farmer John has noticed that his cows often move between nearby fields. Taking this into account, he wants to plant enough grass in each of his fields not only for the cows situated initially in that field, but…
1595 - Symmetry The figure shown on the left is left-right symmetric as it is possible to fold the sheet of paper along a vertical line, drawn as a dashed line, and to cut the figure into two identical halves. The figure on the right is not left-righ…
[USACO12FEB]牛券Cow Coupons(堆,贪心) 题目描述 Farmer John needs new cows! There are N cows for sale (1 <= N <= 50,000), and FJ has to spend no more than his budget of M units of money (1 <= M <= 10^14). Cow i costs P_i money (1 <= P_i <= 10^9), b…
「JSOI2015」symmetry 传送门 我们先考虑构造出原正方形经过 \(4\) 种轴对称变换以及 \(2\) 种旋转变换之后的正方形都构造出来,然后对所得的 \(7\) 个正方形都跑一遍二维哈希,这样我们就可以通过哈希,在 \(O(n ^ 2)\) 时间内判断原正方形中是否存在某一类型的某一大小的子正方形. 但是如果我们枚举边长,复杂度就会达到 \(O(n ^ 3)\) 级别,显然过不了. 考虑优化:我们发现对于任意一种类型的正方形,它把最外面一圈去掉之后还是满足原来的性质,所以我们可以…
P3045 [USACO12FEB]牛券Cow Coupons 贪心题.先选中 \(c_i\) 最小的 \(k\) 头牛,如果这样就超过 \(m\) ,直接退出,输出答案.否则考虑把后面的牛依次加入,替换前面用过券的牛.这里贪心得选择省钱最少的牛替换掉(这样影响最小,最有可能多买几头).加入牛的顺序按照 \(p\) 从小到大,因为如果换不掉就只能话 \(p\) 的钱去买 #include<bits/stdc++.h> using namespace std; #define int long…
tex文档: \documentclass[a4paper, 12pt]{article} % Font size (can be 10pt, 11pt or 12pt) and paper size (remove a4paper for US letter paper) \usepackage{amsmath,amsfonts,bm} \usepackage{hyperref} \usepackage{amsthm,epigraph} \usepackage{amssymb} \usepac…
链接 按x或y排序,假如有对称点的话,头尾相对. #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<stdlib.h> #include<vector> #include<cmath> #include<queue> #include<set> using namespace std…
颓废的一个下午,一直在切水题,(ˉ▽ ̄-) 首先如果这些点是对称的话,那么它们的对称轴就是x = m,m是横坐标的平均值. 把这些点放到一个集合里,然后扫描每个点,计算出它关于x = m的对称点,看这个点是否在集合里面. 如果有一个不在的话,说明不能构成对称图形. #include <cstdio> #include <algorithm> #include <set> using namespace std; struct Point { int x, y; Poin…
题意:给出一个点集,问这个集合有没有中心点使点集对称,这个点可以是点集中的点也可以不是点集的点. 解法:一开始我枚举每两个点连线的中点……结果T了orz当时也不知道怎么想的…… 将点按横坐标排序,如果点集有中心点则中心点一定是排序后排在中间的那个点(n为奇数)或者中间两个点的连线中点(n为偶数),然后判断一下是不是中心点即可. 代码: #include<stdio.h> #include<iostream> #include<algorithm> #include<…
思路:首先,如果这些点对称,那么它们的对称轴是x = m(m是所有点横坐标的平均值):   把这些点放到一个集合里,然后扫描每个点,计算出它关于x = m的对称点,看这个点是否在集合里面.   如果有一个不在的话,说明不能构成对称图形. #include <iostream> #include <algorithm> #include <cstdio> #include <set> using namespace std; struct Point{ int…
给出平面上N(N<=1000)个点.问是否可以找到一条竖线,使得所有点左右对称,如图所示: 则左边的图形有对称轴,右边没有.   Sample Input  3 5 -2 5 0 0 6 5 4 0 2 3 4 2 3 0 4 4 0 0 0 4 5 14 6 10 5 10 6 14 Sample Output YES NO YES 写题永远都是wrong answer..... #include <cstdio> #include <iostream> #include…
题目给出一些点的坐标(横坐标,纵坐标),没有重叠的点,求是否存在一条竖线(平行于y轴的线),使线两边的点左右对称. 我的思路:对于相同的纵坐标的点,即y值相同的点,可以将x的总和计算出,然后除以点的数目,即可得到对称轴的x坐标.所以,对于不同的y值,可以算出这个y值对应的点的对称轴的x坐标,只要观察这些x坐标的值是否相等即可.如果相同,则存在一条竖线满足题意.如果出现不相同,则不存在符合题意的竖线. 注意点:计算后的x的值可能为小数,故需要用double保存. /* UvaOJ 1595 Eme…
这题居然是1A过的.....最近无比失落的心情顿时愉悦起来~ 将数据全部读入 先用二维数据来存储坐标(先把题做出来再说= =) 题目中的x,y的坐标范围是-1W到1W....在数组下标里是不能用负数保存的(当然你偏用map当额没说= =),其实可以把x坐标左移1W个单位,这样最小坐标就从0开始了 然后随便找一行y(当然保证该行至少存在一点),那么可以确定这条竖线mid 枚举每一行,以mid为中点向两边扩展,每找到一对x1,x2,判断equal(mid-x1,x2-mid),若否,直接退出循环,输…
题面 题目描述 Farmer John has noticed that his cows often move between nearby fields. Taking this into account, he wants to plant enough grass in each of his fields not only for the cows situated initially in that field, but also for cows visiting from nea…
题意 给出一棵n个点的无根树,每个点有权值,问每个点向外不重复经过k条边的点权和 题解 设f[i][j]表示所有离i节点距离为j的点权和,v为它周围相邻的点,t为v的个数,则 j > 2 f[i][j] = (sigma f[v][j - 1]) - (t - 1) * f[i][j - 2] j==2 f[i][j] = (sigma f[v][j - 1]) - t * f[i][j - 2] 枚举j,再Dfs即可. 常数巨大的丑陋代码 # include <stdio.h> # i…
题目描述 Being a secret computer geek, Farmer John labels all of his cows with binary numbers. However, he is a bit superstitious, and only labels cows with binary numbers that have exactly K "1" bits (1 <= K <= 10). The leading bit of each la…
题目链接 [洛谷传送门] 题解 矩阵面积的并模板.(请求洛谷加为模板题) 很明显是要离散化的. 我们将矩阵与\(x\)轴平行的两个线段取出来.并且将这两个端点的\(x1\)和\(x2\)进行离散化. 因为每一次我们都会对当前的这一层的某一段线段进行操作,那么就用权值线段树维护是否存在. 这个只是矩阵面积的并. 还有加强版:[HDU 1542] 还有矩阵面积的交. 代码 #include <bits/stdc++.h> #define gc getchar #define lc (nod <…
https://www.luogu.org/problemnew/show/P304 1 #include <bits/stdc++.h> 2 #define up(i,l,r) for(register int i = (l); i <= (r); ++i) 3 #define dn(i,l,r) for(register int i = (l); i >= (r); --i) 4 #define ll long long #define re register using na…