CH Round #49 - Streaming #4 (NOIP模拟赛Day2)
A.二叉树的的根
题目:http://www.contesthunter.org/contest/CH%20Round%20%2349%20-%20Streaming%20%234%20(NOIP 模拟赛Day2)/二叉树的根
题解:自己yy一下就出来了。。。
如果有度数超过3的节点,则不可能成为2叉树,直接输出0即可
否则,树中度数为1和2的点都可以作为根
代码:
var i,n,x,y,tot:longint;
a,d:array[..] of longint;
procedure init;
begin
readln(n);
for i:= to n- do
begin
readln(x,y);inc(d[x]);inc(d[y]);
end;
end;
procedure main;
begin
tot:=;
for i:= to n do
if d[i]>= then begin writeln();exit;end
else if d[i]<= then begin inc(tot);a[tot]:=i;end;
writeln(tot);
write(a[]);
for i:= to tot do write(' ',a[i]);
end; begin
init;
main;
end.
B.距离统计
题目:http://www.contesthunter.org/contest/CH%20Round%20%2349%20-%20Streaming%20%234%20(NOIP模拟赛Day2)/距离统计
题解:正解不可做。。。写暴力还写跪了。。。本来能骗50分,结果最后只有10分。。。
代码:
var tmp,n,m,t,r,x,k:int64;
i,j:longint;
ans:int64;
procedure init;
begin
readln(n,m,t);
if n>m then begin tmp:=n;n:=m;m:=tmp;end;
end;
procedure main;
begin
for i:= to t do
begin
read(r);ans:=;
if m>r then inc(ans,n*(m-r));
if n>r then inc(ans,m*(n-r));
for j:= to trunc(r/sqrt()) do
begin
x:=sqr(r)-sqr(j);
if x<sqr(j) then break;
if trunc(sqrt(x))=sqrt(x) then
begin
k:=trunc(sqrt(x));
if m>k then inc(ans,*(n-j)*(m-k));
if n>k then inc(ans,*(n-k)*(m-j));
end;
end;
write(ans,' ');
end;
end;
begin
init;
main;
end.
C.电阻网络
题目:http://www.contesthunter.org/contest/CH%20Round%20%2349%20-%20Streaming%20%234%20(NOIP模拟赛Day2)/电阻网络
题解:我表示电阻都不会算了。。。果断弃疗。。。
CH Round #49 - Streaming #4 (NOIP模拟赛Day2)的更多相关文章
- CH Round #55 - Streaming #6 (NOIP模拟赛day2)
A.九九归一 题目:http://ch.ezoj.tk/contest/CH%20Round%20%2355%20-%20Streaming%20%236%20(NOIP模拟赛day2)/九九归一 题 ...
- CH Round #55 - Streaming #6 (NOIP模拟赛day2)解题报告
T1九九归一 描述 萌蛋在练习模n意义下的乘法时发现,总有一些数,在自乘若干次以后,会变成1.例如n=7,那么5×5 mod 7=4,4×5 mod 7=6,6×5 mod 7=2,2×5 mod 7 ...
- CH Round #55 - Streaming #6 (NOIP模拟赛day2)(被虐哭)
http://ch.ezoj.tk/contest/CH%20Round%20%2355%20-%20Streaming%20%236%20%28NOIP%E6%A8%A1%E6%8B%9F%E8%B ...
- CH Round #58 - OrzCC杯noip模拟赛day2
A:颜色问题 题目:http://ch.ezoj.tk/contest/CH%20Round%20%2358%20-%20OrzCC杯noip模拟赛day2/颜色问题 题解:算一下每个仆人到它的目的地 ...
- CH Round #48 - Streaming #3 (NOIP模拟赛Day1)
A.数三角形 题目:http://www.contesthunter.org/contest/CH%20Round%20%2348%20-%20Streaming%20%233%20(NOIP模拟赛D ...
- CH Round #54 - Streaming #5 (NOIP模拟赛Day1)
A.珠 题目:http://ch.ezoj.tk/contest/CH%20Round%20%2354%20-%20Streaming%20%235%20(NOIP模拟赛Day1)/珠 题解:sb题, ...
- CH Round #54 - Streaming #5 (NOIP模拟赛Day1)解题报告
最近参加了很多CH上的比赛呢~Rating--了..题目各种跪烂.各种膜拜大神OTZZZ T1珠 描述 萌蛋有n颗珠子,每一颗珠子都写有一个数字.萌蛋把它们用线串成了环.我们称一个数字串是有趣的,当且 ...
- CH Round #54 - Streaming #5 (NOIP模拟赛Day1)(被虐瞎)
http://ch.ezoj.tk/contest/CH%20Round%20%2354%20-%20Streaming%20%235%20%28NOIP%E6%A8%A1%E6%8B%9F%E8%B ...
- 队爷的讲学计划 CH Round #59 - OrzCC杯NOIP模拟赛day1
题目:http://ch.ezoj.tk/contest/CH%20Round%20%2359%20-%20OrzCC杯NOIP模拟赛day1/队爷的讲学计划 题解:刚开始理解题意理解了好半天,然后发 ...
随机推荐
- Java基础知识强化之集合框架笔记21:数据结构之 数组 和 链表
1. 数组 2. 链表
- (转)Smarty Foreach 使用说明
foreach 是除 section 之外处理循环的另一种方案(根据不同需要选择不同的方案). foreach 用于处理简单数组(数组中的元素的类型一致),它的格式比 section 简单许多,缺点是 ...
- postgresql sql修改表,表字段
1.更改表名 alter table 表名 rename to 新表名 2.更改字段名 alter table 表名 rename 字段名 to 新字段名 3.增加列 ALTER TABLE ud_w ...
- hibernate4.3.8整合struts2过程中遇到的问题
1.遇到的异常: Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to ...
- 【原】ios tableViewCell 自适应高度
原文:http://www.cnblogs.com/A--G/p/4819051.html 前言:之前在做一个类似微博的小需求时候,用table view实现了微博文字和图片等等的基本展示,由于文字和 ...
- 百度ios 开发面试题
百度移动云可穿戴部门的面试经历,面试官都非常热情友好,一上来到弄的我挺不好意思的.下面记录一下自己的面试过程,因为我真的没啥面试经验,需要总结下. 1面 Objective C runtime lib ...
- 异常练习一 throw
package 异常练习;class OutageroudleException extends RuntimeException{ OutageroudleException(){ } Outage ...
- 【工具篇】xshell
SSH.telnet.串口登录等,类似Secure CRT,蛮好用的. 中文显示乱码的解决方法,file->properties,在Encoding那里修改为UTF-8 修改颜色,点Edit修改 ...
- ZOJ 刷题记录 小黑屋 (`・д・´)
P1006:模拟 然而我的同余方程能过样例然而就是WA⊙﹏⊙b [已查明:扩展欧几里得算法出了很隐蔽的问题] int exGcd(int x,int y,int& a,int& b) ...
- ThinkPHP框架下,jq实现在div中添加标签并且div的大小会随之变化
php初学者,有什么不对的还请指正. 首先是在html页面中用jq实现添加标签:divAchivePersonnal是select所在的div的外层div,divselectAchivePersonn ...