题目很水。睡过了迟到了一个小时,到达战场一看,俩队友AC五个了。。

就只贴我补的几个吧。

B - Breaking Biscuits Gym - 101606B

旋转卡壳模板题。然后敲错了。

代码是另一种做法:对于每条边,枚举两边的所有点到直线的距离,分别取最大值,然后加起来。

  1. #include <bits/stdc++.h>
  2. #define FOPI freopen("in.txt", "r", stdin);
  3. #define FOPO freopen("out.txt", "w", stdout);
  4. using namespace std;
  5. typedef long long LL;
  6. const double esp = 1e-;
  7. const int maxn = + ;
  8.  
  9. struct Point
  10. {
  11. double x, y;
  12. Point() {}
  13. Point(double _x, double _y) { x = _x, y = _y; }
  14. Point operator - (const Point &b) const
  15. {
  16. return Point(x-b.x, y-b.y);
  17. }
  18. double operator * (const Point &b) const
  19. {
  20. return x*b.x + y*b.y;
  21. }
  22. double length() { return hypot(x, y); }
  23. };
  24. typedef Point Vector;
  25.  
  26. double cross(Vector a, Vector b) { return a.x*b.y - a.y*b.x; }
  27. double dist(Point p, Point a, Point b)
  28. {
  29. return cross(p-a, b-a) / (b-a).length();
  30. }
  31.  
  32. Point a[maxn];
  33. int n;
  34. int main()
  35. {
  36. scanf("%d", &n);
  37. for (int i = ; i <= n; i++) scanf("%lf%lf", &a[i].x, &a[i].y);
  38.  
  39. double ans = 1e50;
  40. for (int i = ; i <= n; i++)
  41. for (int j = i+; j <= n; j++)
  42. {
  43. double left = 1e50, right = -1e50;
  44. for (int k = ; k <= n; k++)
  45. {
  46. left = min(left, dist(a[k], a[i], a[j]));
  47. right = max(right, dist(a[k], a[i], a[j]));
  48. }
  49. ans = min(ans, right-left);
  50. }
  51.  
  52. printf("%.7f\n", ans);
  53. }

F - Flipping Coins Gym - 101606F

dp[i][j] 表示 翻了 j 次后,有 i 个正面朝上的概率。

每次翻面一定优先翻反面朝上的硬币。

那么dp[i][j]的概率可以更新 dp[i+1][j+1] 和 dp[i]j+1]。

特别的,对于 i == n, dp[i][j] 更新的是dp[i-1][j+1] 和 dp[i][j+1]

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int maxn = + ;
  4.  
  5. int n, k;
  6. double dp[maxn][maxn];
  7.  
  8. int main()
  9. {
  10. scanf("%d%d", &n, &k);
  11.  
  12. dp[][] = ;
  13. for (int j = ; j < k; j++)
  14. for (int i = ; i <= n; i++)
  15. {
  16. if (i == n)
  17. {
  18. dp[i-][j+] += 0.5*dp[i][j];
  19. dp[i][j+] += 0.5*dp[i][j];
  20. }
  21. else
  22. {
  23. dp[i+][j+] += 0.5*dp[i][j];
  24. dp[i][j+] += 0.5*dp[i][j];
  25. }
  26. }
  27.  
  28. double ans = ;
  29. for (int i = ; i <= n; i++) ans += dp[i][k] * i;
  30.  
  31. printf("%.7f\n", ans);
  32. }

L - Lizard Lounge Gym - 101606L

对于每一个人求出他和中点的斜率来,然后约分后分类,分别求LIS。

WA了一次是因为求成最长不降升子序列了。估计场上急眼了的话不好查错。

pair还是很好用的。

  1. #include <bits/stdc++.h>
  2. #define FOPI freopen("in.txt", "r", stdin);
  3. #define FOPO freopen("out.txt", "w", stdout);
  4. using namespace std;
  5. typedef long long LL;
  6. const int maxn = 1e6 + ;
  7. typedef pair<int, int> prInt;
  8. typedef pair<double, int> prDouble;
  9.  
  10. int sx, sy;
  11. int n;
  12. int x[maxn], y[maxn];
  13. int k[maxn];
  14. map<prInt, int> M;
  15. vector<prDouble> a[maxn];
  16.  
  17. int LIS(vector<prDouble> &a)
  18. {
  19. int tot = ;
  20. for (int i = ; i < a.size(); i++)
  21. {
  22. int l = , r = tot, x = -;
  23. while(l <= r)
  24. {
  25. int mid = (l+r)/;
  26. if (k[mid] >= a[i].second) x = mid, r = mid-;
  27. else l = mid+;
  28. }
  29. if (x == -) x = ++tot;
  30. k[x] = a[i].second;
  31. }
  32. return tot;
  33. }
  34.  
  35. int main()
  36. {
  37. scanf("%d%d", &sx, &sy);
  38. scanf("%d", &n);
  39. int cnt = ;
  40. for (int i = ; i <= n; i++)
  41. {
  42. int x, y, h;
  43. scanf("%d%d%d", &x, &y, &h);
  44. x -= sx, y -= sy;
  45. int g = __gcd(abs(x), abs(y));
  46. prInt p = prInt(x/g, y/g);
  47. if (!M.count(p)) M[p] = ++cnt;
  48. a[M[p]].push_back(prDouble(hypot(x, y), h));
  49. }
  50.  
  51. int ans = ;
  52. for (int i = ; i <= cnt; i++)
  53. {
  54. sort(a[i].begin(), a[i].end());
  55. ans += LIS(a[i]);
  56. }
  57. printf("%d\n", ans);
  58. }

2017 United Kingdom and Ireland Programming(Gym - 101606)的更多相关文章

  1. Codeforces Gym101606 A.Alien Sunset (2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017))

    2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017) 寒假第一次组队训练赛,和学长一起训练,题目难度是3颗星,我和猪队友写 ...

  2. 2019.04.11 第四次训练 【 2017 United Kingdom and Ireland Programming Contest】

    题目链接:  https://codeforces.com/gym/101606 A: ✅ B: C: ✅ D: ✅ https://blog.csdn.net/Cassie_zkq/article/ ...

  3. [寒假集训第一场]gym101606 2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017)

    3星场 难度在于英文题面太难读懂了QAQ 看样例猜题意的我 博客园的c++主题真丑 A Alien Sunset \(description\) 有\(n\)个星球,每个星球自转时间不一样,所以一天的 ...

  4. 2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017)

    A. Alien Sunset 暴力枚举答案即可. #include<cstdio> int n,i,mx; struct P{ int h,r,t; bool night(int x){ ...

  5. Codeforces Gym101606 C.Cued In (2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017))

    C Cued In 这个题是打球的.都忘了写的什么了... 代码: 1 #include<iostream> 2 #include<cstring> 3 #include< ...

  6. Codeforces Gym101606 J.Just A Minim (2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017))

    J Just A Minim 超级无敌大水题,但是被精度卡了一手,输出要精确到小数点后6位,我直接输出的... 代码: 1 #include<iostream> 2 #include< ...

  7. Codeforces Gym101606 I.I Work All Day (2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017))

    I I Work All Day 这个题就是取模找最小的. 代码: 1 #include<iostream> 2 #include<cstdio> 3 #include< ...

  8. Codeforces Gym101606 E.Education (2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017))

    E Education 这个题有点意思,就是找满足条件的最小价格里的最大值的人数,有点贪心的思想吧,一开始写错了,人群的那个不能排序,而且是最小价格里找能住下人最多的部门,让这个部门去住这个房间.在循 ...

  9. Codeforces Gym101606 D.Deranging Hat (2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017))

    D Deranging Hat 这个题简直了,本来想的是冒泡排序然后逆着输出来的,后来发现不对,因为题目上求的是最优解,而且冒泡的话,输出结果有的超出10000行了,所以就是把一开始的,排好序的字母标 ...

随机推荐

  1. android 开发-ListView列表显示控件的实现

    列表的显示需要三个元素: 1.ListVeiw 用来展示列表的View. 2.适配器 用来把数据映射到ListView上的中介. 3.数据    具体的将被映射的字符串,图片,或者基本组件. 根据列表 ...

  2. orcale开篇

    1.数据库系统和数据库的管理系统  数据库系统=数据库的管理系统+oper操作员+硬件2.Oracle的版本  8i/ 9i 10g/11g  12c(cloud)3.实例和数据库的关系  实例:数据 ...

  3. Vue汇总(搬砖)

    掘金: https://juejin.im/ Element: http://element-cn.eleme.io/#/zh-CN 验证码GEETEST---极验 : https://docs.ge ...

  4. 零基础逆向工程27_Win32_01_宽字符_MessageBox_win32调试输出

    1 多字节字符 ASCII码表:0 ~ 2^7-1 扩展ASCII码表:2^7 ~ 2^8-1 什么是GB2312:1980年,两个字节存储一个汉字:不通用,别国会有乱码. UCICODE:只有一个字 ...

  5. String.format()的用法

    string.format()用法 2011-06-21 14:58:57|  分类: 工作笔记 |  标签:string  format用法   |字号大中小 订阅 1.格式化货币(跟系统的环境有关 ...

  6. iOS - 协议实现的例子

    在实际开发中,协议的应用非常广泛,以下是实际应用的例子. 1.协议的定义: myProtocolDelegate.h // // myProtocolDelegate.h // zlwPlayerAp ...

  7. LEMP (LNMP) Stack-5.4.16 (OpenLogic CentOS 7.2)

    LEMP (LNMP) Stack-5.4.16 (OpenLogic CentOS 7.2) 平台: CentOS 类型: 虚拟机镜像 软件包: mariadb-5.5.47 nginx-1.6.3 ...

  8. NEO

    平台: Windows 类型: 虚拟机镜像 软件包: .net core neo application server basic software blockchain neo open sourc ...

  9. 比特币中P2SH(pay-to-script-hash)多重签名的锁定脚本和解锁脚本

    P2SH(pay-to-script-hash)多重签名的脚本 P2SH是多重签名的一种应用形式.在P2SH的交易中,多了一个Redeem Script的概念,称为赎回脚本.当向P2SH脚本的地址转账 ...

  10. 解决wget下载https时报错 --no-check-certificate (不检查证书)

    如果使用 wget下载https开头的网址域名 时报错,你需要加上 --no-check-certificate (不检查证书)选项 例如: wget https://pypi.python.org/ ...