链接:https://codeforces.com/gym/101606


A - Alien Sunset

暴力枚举小时即可。

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. const int maxn=;
  4. int n;
  5. int h[maxn],r[maxn],s[maxn];
  6. inline bool dark(int id,int time)
  7. {
  8. if(r[id]<s[id])
  9. {
  10. if(r[id]<time && time<s[id]) return ;
  11. else return ;
  12. }
  13. if(r[id]>s[id])
  14. {
  15. if(s[id]<=time && time<=r[id]) return ;
  16. else return ;
  17. }
  18. }
  19. int main()
  20. {
  21. cin>>n;
  22. int mx=;
  23. for(int i=;i<=n;i++) cin>>h[i]>>r[i]>>s[i], mx=max(h[i],mx);
  24.  
  25. for(int time=;time<mx*;time++)
  26. {
  27. bool ok=;
  28. for(int i=;i<=n;i++) if(!dark(i,time%h[i])) ok=;
  29. if(ok)
  30. {
  31. cout<<time<<endl;
  32. return ;
  33. }
  34. }
  35. cout<<"impossible"<<endl;
  36. }

B - Breaking Biscuits - (Undone)


C - Cued In - [水]

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int n;
  4. string s;
  5. map<string,int> mp;
  6. int main()
  7. {
  8. ios::sync_with_stdio();
  9. cin.tie(), cout.tie();
  10.  
  11. mp["red"]=,
  12. mp["yellow"]=,
  13. mp["green"]=,
  14. mp["brown"]=,
  15. mp["blue"]=,
  16. mp["pink"]=,
  17. mp["black"]=;
  18.  
  19. cin>>n;
  20. int red=, sum=, mx=;
  21. for(int i=;i<=n;i++)
  22. {
  23. cin>>s;
  24. mx=max(mx,mp[s]);
  25. if(s=="red") red++;
  26. else sum+=mp[s];
  27. }
  28.  
  29. if(red==n) cout<<"1\n";
  30. else if(red==) cout<<sum<<'\n';
  31. else cout<<red*(mx+)+sum<<'\n';
  32. }

D - Deranging Hat - (Undone)


E - Education - [贪心]

$O(n^2)$ 时间复杂度的贪心。

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef pair<int,int> P;
  4. #define fi first
  5. #define se second
  6. const int maxn=5e3+;
  7.  
  8. int n,m;
  9. P s[maxn];
  10. int ans[maxn];
  11.  
  12. struct F{
  13. int id;
  14. int capa,rent;
  15. bool operator<(const F& o)
  16. {
  17. return capa>o.capa;
  18. }
  19. }f[maxn];
  20. bool vis[maxn];
  21.  
  22. int main()
  23. {
  24. cin>>n>>m;
  25. for(int i=;i<=n;i++) scanf("%d",&s[i].fi), s[i].se=i;
  26. sort(s+,s+n+,greater<P>{});
  27.  
  28. //for(int i=1;i<=n;i++) printf("%d %d\n",s[i].fi,s[i].se);
  29.  
  30. for(int i=;i<=m;i++) f[i].id=i;
  31. for(int i=;i<=m;i++) scanf("%d",&f[i].capa);
  32. for(int i=;i<=m;i++) scanf("%d",&f[i].rent);
  33. sort(f+,f+m+);
  34.  
  35. //for(int i=1;i<=m;i++) printf("%d: %d %d\n",f[i].id,f[i].capa,f[i].rent);
  36.  
  37. memset(vis,,sizeof(vis));
  38. memset(ans,,sizeof(ans));
  39. for(int i=;i<=n;i++)
  40. {
  41. int mn=1e3+, mnid=;
  42. for(int j=;j<=m && f[j].capa>=s[i].fi;j++)
  43. {
  44. if(vis[j]) continue;
  45. if(f[j].rent<mn)
  46. {
  47. mn=f[j].rent;
  48. mnid=j;
  49. }
  50. }
  51. vis[mnid]=;
  52. ans[s[i].se]=f[mnid].id;
  53. }
  54. bool ok=;
  55. for(int i=;i<=n;i++) if(ans[i]==) ok=;
  56. if(ok) for(int i=;i<=n;i++) printf("%d ",ans[i]);
  57. else printf("impossible");
  58. cout<<endl;
  59. }

F - Flipping Coins - [概率DP]


H - Hiking - (Undone)


I - I Work All Day - (Undone)


J - Just A Minim - [水]

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int n;
  4. double t[];
  5. int main()
  6. {
  7. t[]=2.0;
  8. t[]=1.0;
  9. t[]=1.0/2.0;
  10. t[]=1.0/4.0;
  11. t[]=1.0/8.0;
  12. t[]=1.0/16.0;
  13.  
  14. cin>>n;
  15. double res=0.0;
  16. for(int i=,x;i<=n;i++)
  17. {
  18. scanf("%d",&x);
  19. res+=t[x];
  20. }
  21. printf("%.7f\n",res);
  22. }

L - Lizard Lounge - [计算几何+LIS]

Gym 101606 - A/B/C/D/E/F/G/H/I/J/K/L - (Undone)的更多相关文章

  1. codeforces gym 100952 A B C D E F G H I J

    gym 100952 A #include <iostream> #include<cstdio> #include<cmath> #include<cstr ...

  2. codeforces gym101243 A C D E F G H J

    gym101243 A #include<iostream> #include<cstdio> #include<cmath> #include<cstrin ...

  3. 2017-2018 ACM-ICPC, NEERC, Southern Subregional Contest A E F G H I K M

    // 深夜补水题,清早(雾)写水文 A. Automatic Door 题意 \(n(n\leq 1e9)\)个\(employee\)和\(m(m\leq 1e5)\)个\(client\)要进门, ...

  4. The 16th Zhejiang Provincial Collegiate Programming Contest Sponsored(E F G H I)

    http://acm.zju.edu.cn/onlinejudge/showContestProblems.do?contestId=392 E:Sequence in the Pocket 思路:从 ...

  5. 2016CCPC长春 - B/D/F/H/I/J/K - (待补)

    目录: B - Fraction D - Triangle F - Harmonic Value Description H - Sequence I I - Sequence II B题:HDU 5 ...

  6. Codeforces 1214 F G H 补题记录

    翻开以前打的 #583,水平不够场上只过了五题.最近来补一下题,来记录我sb的调试过程. 估计我这个水平现场也过不了,因为前面的题已经zz调了好久-- F:就是给你环上一些点,两两配对求距离最小值. ...

  7. 2017 United Kingdom and Ireland Programming(Gym - 101606)

    题目很水.睡过了迟到了一个小时,到达战场一看,俩队友AC五个了.. 就只贴我补的几个吧. B - Breaking Biscuits Gym - 101606B 旋转卡壳模板题.然后敲错了. 代码是另 ...

  8. ThinkPHP内置函数详解D、F、S、C、L、A、I

    单字母函数D.F.S.C.L.A.I 他们都在ThinkPHP核心的ThinkPHP/Mode/Api/functions.php这个文件中定义. 下面我分别说明一下他们的功能: D() 加载Mode ...

  9. T​h​e​ ​v​a​l​u​e​ ​f​o​r​ ​t​h​e​ ​u​s​e​B​e​a​n​ ​c​l​a​s​s​ ​a​t​t​r​i​b​u​t​e​ ​i​s​ ​invalied

    JSP: T​h​e​ ​v​a​l​u​e​ ​f​o​r​ ​t​h​e​ ​u​s​e​B​e​a​n​ ​c​l​a​s​s​ ​a​t​t​r​i​b​u​t​e​ ​X​X​X​ ​i​s ...

随机推荐

  1. openwrt 加入nand flash的支持

    参考链接 :   https://blog.csdn.net/wwx0715/article/details/77189456?locationNum=9&fps=1

  2. Eclipse中的sysout与debug-遁地龙卷风

    (-1)调试 在读<<一个程序员的奋斗史>>时里面提到这是一件很low的事情,突然想到自己也一直用sysout, 我是一个有情怀的人! (0)sysout的坏处 之所以长久的使 ...

  3. salt软件远程控制服务器

    1.salt安装服务器环境 准备2台机器 192.168.11.250 master端(主人) 192.168.11.167 minion端 (奴隶 ) 2.两台机器配置hosts文件,用于加速域名解 ...

  4. mac office2016

  5. 《尚学堂_史上最易懂的设计模式视频》--章节3 Iterator迭代 模拟列表

    广州尚学堂官网-|广州Java培训|Java培训机构|人工智能+Python培训|PHP培训|全栈工程师培训|UI设计培训|前端移动开发培训http://www.gzsxt.cn/ ==Iterato ...

  6. javascript基础 之 代码规范

    1,变量名 1,变量名推荐使用小驼峰写法:类似于:firstName 2,全局变量和常量建议用大写:PI 3,支持下划线 2,缩进 1,一般使用4个空格当作缩进,tab建议少用 2,运算符左右和左花括 ...

  7. Java 自定义hashmap和hashtable的key注意哪些问题

  8. Django部署方法

    Windows方案: Apache2.4 + Django2.0 网上的方法乱七八糟: 那么接下来:最好的方法,不行吃屎. 当前环境是Django2.0+ python35(64bit) 部署原因: ...

  9. css 冷知识

    *{margin: 0;padding: 0;} li{list-style-type:none; }ul{list-style: none;}img{border: none;}ul,input,s ...

  10. 【sklearn】数据预处理 sklearn.preprocessing

    数据预处理 标准化 (Standardization) 规范化(Normalization) 二值化 分类特征编码 推定缺失数据 生成多项式特征 定制转换器 1. 标准化Standardization ...