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/队爷的讲学计划 题解:刚开始理解题意理解了好半天,然后发 ...
随机推荐
- linux reboot命令
命令简介: 该命令用来重启Linux系统.相当于Windows系统中的restart命令. 命令语法: /sbin/reboot [-n] [-w] [-d] [-f] [-i] 或 reboot [ ...
- python版本简历
- java开发webservice的几种方式(转载)
webservice的应用已经越来越广泛了,下面介绍几种在Java体系中开发webservice的方式,相当于做个记录. 1.Axis2方式 Axis是apache下一个开源的webservice开发 ...
- Java中JIN机制及System.loadLibrary() 的执行过程
Android平台Native开发与JNI机制详解 http://mysuperbaby.iteye.com/blog/915425 个人认为下面这篇转载的文章写的很清晰很不错. 注意Android平 ...
- PHP 一维数组排序
一.按照键值从低到高排序,并赋予新的键名 1 函数:sort( array &array[, int sort_flags]) 2 参数: (1)&array : 要排序的一维数组, ...
- 【POJ1417】【带标记并查集+DP】True Liars
Description After having drifted about in a small boat for a couple of days, Akira Crusoe Maeda was ...
- 内置方法+lambda是pythonic的利器
python可以写的非常简洁,通过使用内置的map,reduce,filter,lambda方法,非常具有文艺范. 举个例子,例如 def fromIpToNum(ipAddr): return ...
- swfupload上传文件问题
如果你的框架用到了struts2的话 可能会造成request冲突 那么解决的办法就是把该request排除出去 不让struts2拦截
- 《uname命令》-linux命令五分钟系列之五
本原创文章属于<Linux大棚>博客. 博客地址为http://roclinux.cn. 文章作者为roc 希望您能通过捐款的方式支持Linux大棚博客的运行和发展.请见“关于捐款” == ...
- PHP表单
二.PHP表单 1.PHP表单处理 welcome.html <html> <body> <form action="welcome.php" met ...