2018 Multi-University Training Contest 6
A.oval-and-rectangle
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6362
题意:在长半轴为a,短半轴为b的椭圆内部,以y=c(0<=c<=b)截取内接矩形,问矩阵周长的期望。
分析:

然后除以b,得到:2*b+pi*a。
直接输出答案即可。要求直接舍弃小数点七位之后,需要先减去0.0000005,再保留6位输出。
#include<bits/stdc++.h>
using namespace std;
const double PI=acos(-);
int main(){
srand((unsigned)time(NULL));
int t;double a,b;scanf("%d",&t);
while(t--){
scanf("%lf%lf",&a,&b);
double ans=*b+PI*a;
ans-=0.0000005;
printf("%.6lf\n",ans);
}
return ;
}
hdoj6362
I.Werewolf
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6370
题意:有n个人,若干个狼或羊,每个人说一句话,羊必须说真话,狼可真可假。问一定有多少个羊,多少个狼。
分析:1.当所有人为狼时,一定成立。所以一定没有铁羊。
2.那么只需要判断铁狼即可。在一个环内,若A指认B为狼,B指认C为羊,C指认A为人,那么B一定为铁狼。此外,指认铁狼为人的人一定为铁狼。由此,可以dfs+标记找出铁狼。
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+;
struct point{
int x,w;
}mp[maxn];
int res,n;
int vis[maxn],k[maxn];
void dfs(int x){
vis[x]=-;
if (mp[x].w==)
vis[x]=mp[x].x;
else{
if (vis[mp[x].x]==) dfs(mp[x].x);
vis[x]=vis[mp[x].x];
if (vis[x]==x || k[mp[x].x]==){
k[x]=;res++;
}
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie();cout.tie();
int t,x;
string ss;
cin >> t;
while (t--){
cin >> n;
for (int i=;i<=n;i++){
cin >> x >> ss;
if (ss[]=='w'){
mp[i].w=;mp[i].x=x;
}
else{
mp[i].w=;mp[i].x=x;
}
}
memset(vis,,sizeof(vis));
memset(k,,sizeof(k));
res=;
for (int i=;i<=n;i++)
if (!vis[i]) dfs(i);
cout << << " " << res << endl;
}
return ;
}
hdoj6370
L.Pinball
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6373
题意:一个小球从位置(x,y)处下落到斜率为b/a的斜坡上,问在斜坡上的碰撞次数。
分析:模拟。
#include<bits/stdc++.h>
using namespace std;
const double g=9.8;
double a,b,x,y;
int main(){
ios::sync_with_stdio(false);
cin.tie();cout.tie();
int tt;
cin >> tt;
while (tt--){
cin >> a >> b >> x >> y;
double sin=b/sqrt(a*a+b*b);
double ax=g*sin;
double h=y+b*x/a;
double v0=sqrt(*g*h);
double t=v0/g;
double v0x=v0*sin;
double aa=x*x,bb=(x*b/a)*(x*b/a),s0=sqrt(aa+bb);
int ans=;
while (s0>){
ans++;
double ss=*t*v0x+*ax*t*t;
s0=s0-ss;
v0x=v0x+*ax*t; //新的速度
}
cout << ans << endl;
}
return ;
}
hdoj6373
2018 Multi-University Training Contest 6的更多相关文章
- 2018 Nowcoder Multi-University Training Contest 2
目录 Contest Info Solutions A. run D. monrey G. transform H. travel I. car J. farm Contest Info Practi ...
- 2018 Nowcoder Multi-University Training Contest 1
Practice Link J. Different Integers 题意: 给出\(n\)个数,每次询问\((l_i, r_i)\),表示\(a_1, \cdots, a_i, a_j, \cdo ...
- 2018 Nowcoder Multi-University Training Contest 5
Practice Link A. gpa 题意: 有\(n\)门课程,每门课程的学分为\(s_i\),绩点为\(c_i\),要求最多删除\(k\)门课程,使得gpa最高. gpa计算方式如下: \[ ...
- 2018 Nowcoder Multi-University Training Contest 10
Practice Link J. Rikka with Nickname 题意: 给出\(n\)个字符串,要求依次合并两个串\(s, t\),满足将\(t\)合并到\(s\)中变成\(r\),使得\( ...
- HDU 2018 Multi-University Training Contest 3 Problem A. Ascending Rating 【单调队列优化】
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=6319 Problem A. Ascending Rating Time Limit: 10000/500 ...
- 2018 Multi-University Training Contest 2
题目链接:2018 Multi-University Training Contest 2 6318 Swaps and Inversions 题意:sum=x*逆序个数+交换次数*y,使sum最小 ...
- 2018 Multi-University Training Contest 1
比赛链接:2018 Multi-University Training Contest 1 6301 Distinct Values 题意:输出一个长度为n的序列,要求满足m个区间的数都不相同,并且字 ...
- hdu 6301 Distinct Values (2018 Multi-University Training Contest 1 1004)
Distinct Values Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)T ...
- 2018 Multi-University Training Contest 4 Problem J. Let Sudoku Rotate 【DFS+剪枝+矩阵旋转】
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=6341 Problem J. Let Sudoku Rotate Time Limit: 2000/100 ...
- 2018 Multi-University Training Contest 4 Problem K. Expression in Memories 【模拟】
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=6342 Problem K. Expression in Memories Time Limit: 200 ...
随机推荐
- create a plugin for PowerShell ISE
可参考:Creating Add-ons, Plugins, and Tools for the PowerShell ISE http://www.leeholmes.com/blog/2013/0 ...
- MVVM中viewmodel的理解
网上有人写了这段话,我也有同感,特别是第一种用法,很重要,后一种用法,我觉得是把第一种用法加入controller中了. 第一种 “view model” 是 “model for the view” ...
- NOIP模拟测试1(2017081501)
好,今天是cgg第一次举行模拟测试,希望各位支持. 时间限制:2小时 题目链接: 题目一:水得都没名字了 题目二:车站 题目三:选数 不要觉得2小时太少,我的题目很良心,都很简单. 答案可以在模拟测试 ...
- 20155312 2006-2007-2 《Java程序设计》第三周学习总结
20155312 2006-2007-2 <Java程序设计>第三周学习总结 课堂内容总结 yyp复制上一行代码 5不是false statistics.sh换成.bat就可以在windo ...
- php mongodb driver
yum install -y PHP-devel php-pear httpd-devel pecl install mongo 执行以上命令后,你需要修改php.ini文件,在php.ini文件中添 ...
- 关于oracle的锁表解决session marked for kill
oracle 使用的过程中,有时候会遇到锁表的情况,数据库增.删.改.查都是会锁表的,但是锁的类型会不同, 大多是行锁,部分会是表锁. 在oracle运行中,一直是有表在锁的,只不过很快一个操作结束, ...
- 2018.11.17 hdu5829Rikka with Subset(ntt)
传送门 nttnttntt基础题. 考虑计算每一个数在排名为kkk时被统计了多少次来更新答案. 这样的话,设anskans_kansk表示所有数的值乘上排名为kkk的子集数的总和. 则ansk=∑i ...
- 1.2OpenCV如何扫描图像,利用查找表和计时
查找表 颜色缩减法:如果矩阵元素存储的是单通道像素,使用C或C++的无符号字符类型,那么像素可有256个不同值. 但若是三通道图像,这种存储格式的颜色数就太多了(确切地说,有一千六百多万种).用如此之 ...
- hashCode() 和equals() 区别和作用(转)
出处:https://www.jianshu.com/p/5a7f5f786b75 本章的内容主要解决下面几个问题: 1 equals() 的作用是什么? 2 equals() 与 == 的区别是什么 ...
- TCP/IP协议(6):传输层之UDP
一. UDP用户数据报协议,它是一个无连接的,面向数据报的协议,它不提供可靠性但传输速度比TCP要快. UDP数据报中的“UDP长度”为两个字节,所以我们要发送的UDP数据最多支持65507大约68K ...