A - oval-and-rectangle

题意:给出一个椭圆的a 和 b,在$[0, b]中随机选择c$ 使得四个顶点在椭圆上构成一个矩形,求矩形周长期望

思路:求出每种矩形的周长,除以b(积分)

 #include<bits/stdc++.h>

 using namespace std;

 const double PI = acos(-1.0);

 double a, b;

 void RUN()
{
int t;
scanf("%d", &t);
while (t--)
{
scanf("%lf %lf", &a, &b);
double ans = * b + a * PI;
printf("%.6f\n", ans - 5e-);
}
} int main()
{
#ifdef LOCAL_JUDGE
freopen("Text.txt", "r", stdin);
#endif // LOCAL_JUDGE RUN(); #ifdef LOCAL_JUDGE
fclose(stdin);
#endif // LOCAL_JUDGE
return ;
}

B - bookshelf

留坑。

C - Ringland

留坑。

D - Shoot Game

留坑。

E - black-and-white

留坑。

F - foam-transformation

留坑。

G - Variance-MST

留坑。

H - Rectangle Outline

留坑。

I - Werewolf

题意:狼人杀游戏,每个人都会指明另一个人的身份,村民一定不会说谎,狼人可能说谎,求确定的村民和狼人

思路:若果全都是狼人,那么逻辑一定成立,所以确定的村民数量为0.对于狼人可以通过反证法证明,若1认为2是村民,2认为3为村民,3认为4为村民,4认为2为狼人,反证法得出12位狼人,以此类推,DFS一下即可

 #include<bits/stdc++.h>

 using namespace std;

 const int maxn = (int)1e5 + ;

 int n;
int ans1,ans2;
int fa[maxn];
char str[];
vector<pair<int, int> >wolf;
vector<int>human[maxn]; void Init(int n)
{
ans1 = ans2 = ;
for (int i = ; i <= n; ++i) fa[i] = i, human[i].clear();
wolf.clear();
} int find(int x)
{
return x == fa[x] ? fa[x] : fa[x] = find(fa[x]);
} void mix(int x, int y)
{
x = find(x), y = find(y);
if (x != y)
{
fa[x] = y;
}
} bool same(int x, int y)
{
return find(x) == find(y);
} void DFS(int u)
{
for (auto it : human[u])
{
++ans2;
DFS(it);
}
} void RUN()
{
int t;
scanf("%d", &t);
while (t--)
{
scanf("%d", &n);
Init(n);
for (int i = ; i <= n; ++i)
{
int u;
scanf("%d %s", &u, str);
if (str[] == 'v')
{
mix(i, u);
human[u].push_back(i);
}
else
{
wolf.push_back(make_pair(i, u));
}
}
for (auto it : wolf)
{
if (same(it.first, it.second))
{
++ans2;
DFS(it.second);
}
}
printf("%d %d\n", ans1, ans2);
}
} int main()
{
#ifdef LOCAL_JUDGE
freopen("Text.txt", "r", stdin);
#endif // LOCAL_JUDGE RUN(); #ifdef LOCAL_JUDGE
fclose(stdin);
#endif // LOCAL_JUDGE
return ;
}

J - Chopping hands

留坑。

K - sacul

留坑。

L - Pinball

题意:一个小球垂直下落在一个斜板上,求在斜板上弹几次

思路:分解小球运动(物理题)

 #include<bits/stdc++.h>

 using namespace std;

 const double g = 9.8;
double a, b, x, y; void RUN()
{
int t;
scanf("%d", &t);
while (t--)
{
scanf("%lf %lf %lf %lf", &a, &b, &x, &y);
x = -1.0 * x;
double Tan = b / a;
double arc = atan(Tan);
double vx = g * sin(arc);
double vy = g * cos(arc);
double h = (y - b / a * x) * cos(arc);
double dis = (y - b / a * x) * sin(arc) + x / cos(arc);
double t = sqrt( * dis / vx );
double per = sqrt( * h / vy);
int ans = ;
if (t > per)
{
ans++;
t -= per;
}
ans += t / (per * );
printf("%d\n", ans);
}
} int main()
{
#ifdef LOCAL_JUDGE
freopen("Text.txt", "r", stdin);
#endif // LOCAL_JUDGE RUN(); #ifdef LOCAL_JUDGE
fclose(stdin);
#endif // LOCAL_JUDGE
return ;
}

2018 Multi-University Training Contest 6 Solution的更多相关文章

  1. 2018 Multi-University Training Contest 1 Solution

    A - Maximum Multiple 题意:给出一个n 找x, y, z 使得$n = x + y +z$ 并且 $n \equiv 0 \pmod x, n \equiv 0 \pmod y, ...

  2. 2018 Multi-University Training Contest 2 Solution

    A - Absolute 留坑. B - Counting Permutations 留坑. C - Cover 留坑. D - Game puts("Yes") #include ...

  3. 2018 Multi-University Training Contest 3 Solution

    A - Problem A. Ascending Rating 题意:给出n个数,给出区间长度m.对于每个区间,初始值的max为0,cnt为0.遇到一个a[i] > ans, 更新ans并且cn ...

  4. 2018 Multi-University Training Contest 4 Solution

    A - Problem A. Integers Exhibition 留坑. B - Problem B. Harvest of Apples 题意:计算$\sum_{i = 0}^{i = m}C( ...

  5. 2018 Multi-University Training Contest 5 Solution

    A - Always Online Unsolved. B - Beautiful Now Solved. 题意: 给出一个n, k  每次可以将n这个数字上的某两位交换,最多交换k次,求交换后的最大 ...

  6. 2018 Multi-University Training Contest 7 Solution

    A - Age of Moyu 题意:给出一张图,从1走到n,如果相邻两次走的边的权值不同,花费+1, 否则花费相同,求最小花费 思路:用set记录有当前点的最小花费有多少种方案到达,然后最短路 #i ...

  7. 2018 Multi-University Training Contest 8 Solution

    A - Character Encoding 题意:用m个$0-n-1$的数去构成k,求方案数 思路:当没有0-n-1这个条件是答案为C(k+m-1, m-1),减去有大于的关于n的情况,当有i个n时 ...

  8. 2018 Multi-University Training Contest 9 Solution

    A - Rikka with Nash Equilibrium 题意:构造一个$n * m$的矩阵,使得$[1, n * m]$ 中每个数只出现一次,并且纳什均衡只出现一次. 思路:从大到小的放置,每 ...

  9. 2018 Multi-University Training Contest 10 Solution

    A - Problem A.Alkane 留坑. B - Problem B. Beads 留坑. C - Problem C. Calculate 留坑. D - Problem D. Permut ...

随机推荐

  1. 动态调整UITableViewCell高度的实现方法

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPa ...

  2. 【转】实现Ribbon风格的窗体

    随着office2007的兴起,微软让我们看到了Ribbon风格的窗体,现在很多软件也都开始使用Ribbon风格.那么我们如果要自己开发,应当怎么做呢?本文就是为大家解开这个疑团的. 首先,Delph ...

  3. LeetCode——Search a 2D Matrix II

    Description: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix ...

  4. windows下的mysql迁移到linux下

    最近做毕业设计,需要把windows下的mysql移植到linux下 曾经有过在window下移植mysql数据库的经验,只需要把msql的数据文件复制到另一台安装mysql的机器的数据存放位置,然后 ...

  5. eclipse中切换jdk版本

    安装了jdk1.8,但是项目使用的是jdk1.7,需要更改eclipse中的jdk版本 右键项目propeties  ---  Project facets

  6. mysql日期处在某两个时间段之间的between比较

    where SYSDATE() between '2018-08-28 09:21:48' and '2018-08-28 09:25:48' sysdate()等于2018-08-28 09:23: ...

  7. 使用Spring报错:No default constructor found;

    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error ...

  8. MYSQL-max_binlog_cache_size参数

    max_binlog_cache_size 解释:这是设置最大二进制日志的缓存区大小的变量.若处理多语句事务时需要的内存大小比设置值大的话就会提示一个error:Multi-statement tra ...

  9. 最小树形图(hdu4009)

    Transfer water Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others) T ...

  10. Linux系列-Xshell连接本地VMware安装的Linux虚拟机

    一.安装VMwareWorkstation并安装RedHat虚拟机,这里安装步骤省略,网络的资料很多,大侠们不如百度或者谷歌一下,大把的资料. 二.打开本地电脑的“网络连接”,你会发现多出了2个网络适 ...