Ural Vol1(dif>=900)
目前已AC: 2
1040.Airline Company(构造)
题目要求与每个顶点相连的所有边编号最大公约数为1,其实只要其中的两条边编号互质,所有边编号的最大公约数一定为1。我们知道相邻的数字一定互质,那么只要与一个顶点相连的所有边中有两条编号相邻,这个顶点就可以符合条件。DFS序列,对边进行编号刚好可以构造出满足要求的解,并且无解的情况是不存在的。
# include <cstdio> # include <cstring> # include <cstdlib> # include <iostream> # include <vector> # include <queue> # include <stack> # include <map> # include <set> # include <cmath> # include <algorithm> using namespace std; # define lowbit(x) ((x)&(-x)) # define pi acos(-1.0) # define eps 1e- # define MOD # define INF # define mem(a,b) memset(a,b,sizeof(a)) # define FOR(i,a,n) for(int i=a; i<=n; ++i) # define FO(i,a,n) for(int i=a; i<n; ++i) # define bug puts("H"); # define lch p<<,l,mid # define rch p<<|,mid+,r # define mp make_pair # define pb push_back typedef pair<int,int> PII; typedef vector<int> VI; # pragma comment(linker, "/STACK:1024000000,1024000000") typedef long long LL; int Scan() { , flag=; char ch; ; '; +(ch-'); return flag?-res:res; } void Out(int a) { ) {putchar('-'); a=-a;} ) Out(a/); putchar(a%+'); } ; //Code begin... ][], dfn[][], node[], n, tot; vector<PII>edge; void dfs(int x) { node[x]=; FOR(i,,n) ) dfn[x][i]=dfn[i][x]=++tot, dfs(i); } int main () { int m, u, v; scanf("%d%d",&n,&m); ; FOR(i,,n) ) dfs(i); puts("YES"); ; i<edge.size(); ++i) printf("%d ",dfn[edge[i].first][edge[i].second]); putchar('\n'); ; }
1075.Thread in a Space(高中几何)
# include <cstdio> # include <cstring> # include <cstdlib> # include <iostream> # include <vector> # include <queue> # include <stack> # include <map> # include <set> # include <cmath> # include <algorithm> using namespace std; # define lowbit(x) ((x)&(-x)) # define pi acos(-1.0) # define eps 1e- # define MOD # define INF # define mem(a,b) memset(a,b,sizeof(a)) # define FOR(i,a,n) for(int i=a; i<=n; ++i) # define FO(i,a,n) for(int i=a; i<n; ++i) # define bug puts("H"); # define lch p<<,l,mid # define rch p<<|,mid+,r # define mp make_pair # define pb push_back typedef pair<int,int> PII; typedef vector<int> VI; # pragma comment(linker, "/STACK:1024000000,1024000000") typedef long long LL; int Scan() { , flag=; char ch; ; '; +(ch-'); return flag?-res:res; } void Out(int a) { ) {putchar('-'); a=-a;} ) Out(a/); putchar(a%+'); } ; //Code begin... template<class T> T sqr(T x) { return x*x; } int main() { double xa, ya, za, xb, yb, zb, xc, yc, zc, r; scanf("%lf%lf%lf", &xa, &ya, &za); scanf("%lf%lf%lf", &xb, &yb, &zb); scanf("%lf%lf%lf", &xc, &yc, &zc); scanf("%lf", &r); double ab=sqrt(sqr(xa-xb) + sqr(ya-yb) + sqr(za-zb)); double ac=sqrt(sqr(xa-xc) + sqr(ya-yc) + sqr(za-zc)); double bc=sqrt(sqr(xb-xc) + sqr(yb-yc) + sqr(zb-zc)); *ac*bc)); double a=acos(r/ac); double b=acos(r/bc); if(a+b>=c) printf("%.2lf\n", ab); else printf("%.2lf\n", (c-a-b)*r + sqrt(sqr(ac) - sqr(r)) + sqrt(sqr(bc) - sqr(r))); ; }
Ural Vol1(dif>=900)的更多相关文章
- ural 1269. Obscene Words Filter
1269. Obscene Words Filter Time limit: 0.5 secondMemory limit: 8 MB There is a problem to check mess ...
- URAL 1145—— Rope in the Labyrinth——————【求树的直径】
Rope in the Labyrinth Time Limit:500MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64 ...
- ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'
凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...
- ural 1208 Legendary Teams Contest
题意描述:给定K支队伍,每队三个队员,不同队伍之间队员可能部分重复,输出这些队员同时能够组成多少完整的队伍: DFS,利用DFS深度优先搜索,如果该队所有队员都没有被访问过,那么将该队计入结果,再去选 ...
- 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...
- ural 2071. Juice Cocktails
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...
- ural 2073. Log Files
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...
- ural 2070. Interesting Numbers
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...
- ural 2069. Hard Rock
2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...
随机推荐
- linux的学习系列 3---目录
目录也是一个文件,它的唯一功能是用来保存文件及其相关信息.所有的文件,包括普通文件.设备文件和目录文件,都会被保存到目录中. 主目录 登录后,你所在的位置就是你的主目录(或登录目录),接下来你主要是在 ...
- OVS - commands
journalctl -t ovs-vswitchd ovs-vsctl show ovs-ofctl show br0 set vlanid ovs-vsctl set port eth0 tag= ...
- java 反射的实例
JAVA反射机制是在运行状态中,对于任意一个类,都能够得到这个类的所有属性和方法;对于任意一个对象,都能够调用它的任意一个方法;这种动态获取的信息以及动态调用对象的方法的功能称为java语言的反射机制 ...
- AutoTile 自动拼接(六 大结局) 学习与实践
昨天在网上找了一些资源图片,这回就不用担心 背景资源不多的问题了,现在我一边 制作,一边发布文章. 各种各样,500多个,这里还是特别感谢 ,万恶的资本主义,不设密码就给我分享. 在制作前,大家看下这 ...
- Oracle sql优化之分析函数优化标量子查询
待优化语句如下 select a.code as code, a.m_code as m_code,a.stktype as f_stype,a.e_year as e_year, b.sname a ...
- 转:使用WebDriver过程中遇到的那些问题
在做web项目的自动化端到端测试时主要使用的是Selenium WebDriver来驱动浏览器.Selenium WebDriver的优点是支持的语言多,支持的浏览器多.主流的浏览器Chrome.Fi ...
- hdu_5738_Eureka(脑洞)
题目链接:hdu_5738_Eureka 题意: 这题感觉说不清楚,坑点有点坑,一不小心就会推出错误的公式,然后最重要的是你还不知道你推错了 题解: 这里贴一个官方的题解 Eureka xjb推导一下 ...
- Python 数据挖掘 工具包整理
连接器与io 数据库 类别 Python R MySQL mysql-connector-python(官方) RMySQL Oracle cx_Oracle ROracle MongoDB pymo ...
- 为什么我的Android SDK Manager中只显示已安装的package?
如图.在菜单packages中,前两项我都是选了的 . 两种可能: 1. 明显是楼主连不上谷歌的更新服务器了,换成国内的吧,左上Tools-->Options弹出的界面有两个可以填写的 ,下面一 ...
- 如何让struts2和servlet的共存
如何让struts2和servlet的共存 (2013-08-29 14:07:49) 转载▼ 标签: servlet与struts2共存 同时配置struts2与ser servlet访问不到 分类 ...