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/队爷的讲学计划 题解:刚开始理解题意理解了好半天,然后发 ...
随机推荐
- Unity3D 游戏的碰撞
首先创建两个精灵,然后都绑定上碰撞方法(这个是在上一篇文章的基本上): 不过 要注意一点就是碰撞器需要挂一个重力组件,不然无效 所以添加了差不多就能够实现物体碰撞了: 接下来技术写代码,让碰撞的时候进 ...
- 玩javaweb的web.xml编译路径
有时候能够碰到这样的情况 缓存就是 清不掉 那就可以去寻找编译路径了 <Context docBase="E:\java-workspace\eigyo_com405" pa ...
- maven 依赖冲突的问题
如果原始系统的jarA依赖jarB1.0 而新引入的jarC依赖jarB2.0 导致系统启动报错,提示冲突,这时为了保证原始系统的稳定性, 在pom.xml文件中引入jarC时,需要exclude掉j ...
- NetAdvantage webdatagrid 控件的一些属性
属性: 1 behaviors 行为下的属性集合 Row Selectors 主要用于设置行选择样式与形为的集合 Enable 属性表示是否启用 Row Selectors下的属性设置 RowNumB ...
- one way WebService
WSDL支持4种消息交换方式: 1)单向(One-way):服务端接收消息: 2)请求响应(Request-response):服务端点接收请求消息,然后发送响应消息: 3)要求应答(So ...
- Using GUID to generate the unique file name in C#
GUID, the abbreviation of "Global Unique Identifier", is a unique reference number used as ...
- Fedora 21 安装Infinality
原文地址: Fedora 21 用infinality美化你的字体 http://blog.csdn.net/element207/article/details/41746683 安装infinal ...
- 永久关闭防火墙和selinux
临时关闭selinux: setenforce 0 //设置SELinux 成为permissive模式 彻底禁用selinux: 使用root用户,vim /etc/sysconfig/sel ...
- 神秘链接__proto__是什么鬼
_proto_实际上是某个实例对象的隐藏属性,而prototype是其构造器函数(或者说‘类’)的原型属性; function Mine() {} var hi = new Function(), ...
- C# .NET3.5 改为 到.NET2.0 时 TypedTableBase 报错解决方法
NET 3.5 降版本 到.NET 2.0.不出意外,问题必然来了.编译错误一:错误 1 命名空间“System”中不存在类型或命名空间名称“Linq”(是缺少程序集引用吗?)解决:删掉该引用--没用 ...