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)的更多相关文章

  1. CH Round #55 - Streaming #6 (NOIP模拟赛day2)

    A.九九归一 题目:http://ch.ezoj.tk/contest/CH%20Round%20%2355%20-%20Streaming%20%236%20(NOIP模拟赛day2)/九九归一 题 ...

  2. 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 ...

  3. 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 ...

  4. CH Round #58 - OrzCC杯noip模拟赛day2

    A:颜色问题 题目:http://ch.ezoj.tk/contest/CH%20Round%20%2358%20-%20OrzCC杯noip模拟赛day2/颜色问题 题解:算一下每个仆人到它的目的地 ...

  5. CH Round #48 - Streaming #3 (NOIP模拟赛Day1)

    A.数三角形 题目:http://www.contesthunter.org/contest/CH%20Round%20%2348%20-%20Streaming%20%233%20(NOIP模拟赛D ...

  6. 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题, ...

  7. CH Round #54 - Streaming #5 (NOIP模拟赛Day1)解题报告

    最近参加了很多CH上的比赛呢~Rating--了..题目各种跪烂.各种膜拜大神OTZZZ T1珠 描述 萌蛋有n颗珠子,每一颗珠子都写有一个数字.萌蛋把它们用线串成了环.我们称一个数字串是有趣的,当且 ...

  8. 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 ...

  9. 队爷的讲学计划 CH Round #59 - OrzCC杯NOIP模拟赛day1

    题目:http://ch.ezoj.tk/contest/CH%20Round%20%2359%20-%20OrzCC杯NOIP模拟赛day1/队爷的讲学计划 题解:刚开始理解题意理解了好半天,然后发 ...

随机推荐

  1. 10.27 noip模拟试题

    1.铺瓷砖(tile.cpp/c/pas)[问题描述]有一面很长很长的墙. 你需要在这面墙上贴上两行瓷砖. 你的手头有两种不同尺寸的瓷砖,你希望用这两种瓷砖各贴一行.瓷砖的长可以用分数表示,贴在第一行 ...

  2. 知识点摸清 - - position属性值之relative与absolute

    两者共同特点是: 改变文档流 激活元素left.top.right.bottom.z-index属性 让元素”浮起来“,z-index>0 不同的是: 1.position:relative 会 ...

  3. 解决UITableView中Cell重用机制导致内容出错的方法总结

    UITableView继承自UIScrollview,是苹果为我们封装好的一个基于scroll的控件.上面主要是一个个的 UITableViewCell,可以让UITableViewCell响应一些点 ...

  4. centos7/RHEL7安装LibreOffice

    1.下载 wget http://download.documentfoundation.org/libreoffice/testing/4.4.0/rpm/x86_64/LibreOfficeDev ...

  5. php 购物车完整实现代码

    1.商品展示页面 代码如下: <table width="255" border="0" cellspacing="0" cellpa ...

  6. python自动开发之第十三天

    1.Paramiko模块下的demo.py程序     前面利用Python中的Paramiko模块可以进行SSH的连接,以及用来传送文件(SFTP),但是无论是哪一种方式,连接都是短暂的,并非是长连 ...

  7. 总结:S5PV210时钟系统

    在数据手册<S5PV210_UM_REV1.1>中的section 02_system/3 CLOCK CONTROLLER(354页)   一.时钟域 在S5PV210的SoC中,时钟系 ...

  8. 张江在线APP演示

    app下载地址:https://itunes.apple.com/cn/app/zhang-jiang-zai-xian/id722630317?mt=8

  9. uboot移植参考资料

    参考文档:移植u-boot-1.1.6到TQ2440文档.pdf 参考网页:uboot在S3C2440上移植<出自超哥(相广超)>

  10. 解决m2eclipse之Unable to update index for central |

    maven 不能更新,真烦人,转载他人的 maven是个好东西,eclipse上的maven插件m2eclipse也非常方便,但是最近这个东西经常无法连接到maven index的更新网站,然后ecl ...