A - oval-and-rectangle

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

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

  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. const double PI = acos(-1.0);
  6.  
  7. double a, b;
  8.  
  9. void RUN()
  10. {
  11. int t;
  12. scanf("%d", &t);
  13. while (t--)
  14. {
  15. scanf("%lf %lf", &a, &b);
  16. double ans = * b + a * PI;
  17. printf("%.6f\n", ans - 5e-);
  18. }
  19. }
  20.  
  21. int main()
  22. {
  23. #ifdef LOCAL_JUDGE
  24. freopen("Text.txt", "r", stdin);
  25. #endif // LOCAL_JUDGE
  26.  
  27. RUN();
  28.  
  29. #ifdef LOCAL_JUDGE
  30. fclose(stdin);
  31. #endif // LOCAL_JUDGE
  32. return ;
  33. }

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一下即可

  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. const int maxn = (int)1e5 + ;
  6.  
  7. int n;
  8. int ans1,ans2;
  9. int fa[maxn];
  10. char str[];
  11. vector<pair<int, int> >wolf;
  12. vector<int>human[maxn];
  13.  
  14. void Init(int n)
  15. {
  16. ans1 = ans2 = ;
  17. for (int i = ; i <= n; ++i) fa[i] = i, human[i].clear();
  18. wolf.clear();
  19. }
  20.  
  21. int find(int x)
  22. {
  23. return x == fa[x] ? fa[x] : fa[x] = find(fa[x]);
  24. }
  25.  
  26. void mix(int x, int y)
  27. {
  28. x = find(x), y = find(y);
  29. if (x != y)
  30. {
  31. fa[x] = y;
  32. }
  33. }
  34.  
  35. bool same(int x, int y)
  36. {
  37. return find(x) == find(y);
  38. }
  39.  
  40. void DFS(int u)
  41. {
  42. for (auto it : human[u])
  43. {
  44. ++ans2;
  45. DFS(it);
  46. }
  47. }
  48.  
  49. void RUN()
  50. {
  51. int t;
  52. scanf("%d", &t);
  53. while (t--)
  54. {
  55. scanf("%d", &n);
  56. Init(n);
  57. for (int i = ; i <= n; ++i)
  58. {
  59. int u;
  60. scanf("%d %s", &u, str);
  61. if (str[] == 'v')
  62. {
  63. mix(i, u);
  64. human[u].push_back(i);
  65. }
  66. else
  67. {
  68. wolf.push_back(make_pair(i, u));
  69. }
  70. }
  71. for (auto it : wolf)
  72. {
  73. if (same(it.first, it.second))
  74. {
  75. ++ans2;
  76. DFS(it.second);
  77. }
  78. }
  79. printf("%d %d\n", ans1, ans2);
  80. }
  81. }
  82.  
  83. int main()
  84. {
  85. #ifdef LOCAL_JUDGE
  86. freopen("Text.txt", "r", stdin);
  87. #endif // LOCAL_JUDGE
  88.  
  89. RUN();
  90.  
  91. #ifdef LOCAL_JUDGE
  92. fclose(stdin);
  93. #endif // LOCAL_JUDGE
  94. return ;
  95. }

J - Chopping hands

留坑。

K - sacul

留坑。

L - Pinball

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

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

  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. const double g = 9.8;
  6. double a, b, x, y;
  7.  
  8. void RUN()
  9. {
  10. int t;
  11. scanf("%d", &t);
  12. while (t--)
  13. {
  14. scanf("%lf %lf %lf %lf", &a, &b, &x, &y);
  15. x = -1.0 * x;
  16. double Tan = b / a;
  17. double arc = atan(Tan);
  18. double vx = g * sin(arc);
  19. double vy = g * cos(arc);
  20. double h = (y - b / a * x) * cos(arc);
  21. double dis = (y - b / a * x) * sin(arc) + x / cos(arc);
  22. double t = sqrt( * dis / vx );
  23. double per = sqrt( * h / vy);
  24. int ans = ;
  25. if (t > per)
  26. {
  27. ans++;
  28. t -= per;
  29. }
  30. ans += t / (per * );
  31. printf("%d\n", ans);
  32. }
  33. }
  34.  
  35. int main()
  36. {
  37. #ifdef LOCAL_JUDGE
  38. freopen("Text.txt", "r", stdin);
  39. #endif // LOCAL_JUDGE
  40.  
  41. RUN();
  42.  
  43. #ifdef LOCAL_JUDGE
  44. fclose(stdin);
  45. #endif // LOCAL_JUDGE
  46. return ;
  47. }

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. ionic调用数据接口(post、解决 payload 问题)

    $http({method:'POST', url:apiUrl, headers:{'Content-Type': 'application/x-www-form-urlencoded; chars ...

  2. Linux mysqladmin 命令

    mysqladmin命令可以用来设置或修改 MySQL 密码,常见用法如下: [root@localhost ~]$ mysqladmin -uroot password 'newPass' # 在无 ...

  3. Python 列表表达式与生成器表达式

    列表表达式: (1) 语法1:[表达式 for 变量 in 列表],表示把得到的每一个变量值都放到 for 前面的表达式中计算 ,然后生成一个列表(2) 语法2:[表达式 for 变量 in 列表 i ...

  4. iOS设计模式之类族(class cluster)

    类族模式在UIKit(user interface framework)使用的范围已经远远超过我们的想象,比如,UIButton,NSArray,NSString,NSNumber等, 例如NSNum ...

  5. c++11——std::function和bind绑定器

    c++11中增加了std::function和std::bind,可更加方便的使用标准库,同时也可方便的进行延时求值. 可调用对象 c++中的可调用对象存在以下几类: (1)函数指针 (2)具有ope ...

  6. 高中生的IT之路-1.1自序

        近几年来越来越多的人问我关于 高中生要不要读大学.大学选择专业.毕业后的择业问题,索性我不如把我对这几方面的理解写出来,如果有幸能帮助到更多的人,那也算是个人对社会做出了一点贡献.       ...

  7. TextureMerger1.6.6 三:Bitmap Font的制作和使用

    BitmapFont主要用于特殊字体在游戏中的使用. 比如我想使用方正剪纸字体,但是没加载方正剪纸.ttf字体时,egret是没法使用这种字体的. 或者美工制作了效果拔群的0123456789数字字体 ...

  8. 查询hadoop参数变量

    [hadoop@master hadoop]$ hive -S -e 'set -v'|grep querylog|grep -E -v 'CLASSPATH|class'hive.querylog. ...

  9. 判断手机访问还是pc访问

    function isMobile(){ // 如果有HTTP_X_WAP_PROFILE则一定是移动设备 if (isset ($_SERVER['HTTP_X_WAP_PROFILE'])) re ...

  10. JAVAWEB Filter使用

    Filter学习 1Filter是什么:是过滤器简称 2Filter有什么作用:在filter中可以得到代表用户请求和响应的request.response对象,因此在编程中可以使用Decorator ...