2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017)

寒假第一次组队训练赛,和学长一起训练,题目难度是3颗星,我和猪队友写了6题,第二次训练赛,题目难度2颗星,写出了8道题,两次比赛都不是第一,差一点,很伤。

这是第一次训练的题解,第二次的在上一篇博客,本来不想今天写题解的,但是明天又有新的训练。

写吧写吧,谁让我是最菜的(;´д`)ゞ,随便写写,头疼。。。因为是PDF的题目,不贴题目了,直接上代码。。。

A Alien Sunset

这个题是日出日落的,不是我写的,猪队友写的,贴他的代码。

代码:(猪的)

 #include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <vector>
using namespace std;
const int maxn = 1e6+;
const int maxm = 1e4+;
const int inf = 0x3f3f3f3f;
const double epx = 1e-;
typedef long long ll;
const ll INF = 1e18;
struct node
{
int d,h,r;
int l;
}a[maxn];
int b[maxn][];
int n;
int main()
{
cin>>n;
int maxx=;
for(int i=;i<=n;i++)
{
cin>>a[i].d>>a[i].h>>a[i].r;
a[i].l=a[i].d;
maxx=max(maxx,a[i].d);
}
for(int i=;i<maxx*;i++)
{
for(int j=;j<=n;j++)
{
if(i>a[j].d-)
{
a[j].d+=a[j].l;
a[j].h+=a[j].l;
a[j].r+=a[j].l;
}
if(a[j].h<a[j].r)
{
if(i>a[j].h&&i<a[j].r)
b[i][j]=;
else
b[i][j]=;
}
else
{
if(i>=a[j].r&&i<=a[j].h)
b[i][j]=;
else
b[i][j]=;
}
}
}
int ans=-;
for(int i=;i<maxx*;i++)
{
int sum=;
for(int j=;j<=n;j++)
{
if(b[i][j]==)
sum++;
}
if(sum==n)
{
ans=i;
break;
}
}
if(ans!=-)
printf("%d\n",ans);
else
printf("impossible\n");
}

最新文章

  1. angular中的compile和link函数
  2. ios合并静态库
  3. Linux tcpdump 命令详解
  4. [Django_1_2]数据库设置
  5. C++ Interview - using new and delete to alloc and free memory
  6. JAVA编译中拒绝访问的问题及解决方案
  7. 在IIS上发布Web(使用VS2005)
  8. static 控件颜色修改
  9. 转Y-slow23原则(雅虎)
  10. python中的可变与不可变对象
  11. 在 HTML5 中捕获音频和视频
  12. webpack4: compilation.mainTemplate.applyPluginsWaterfall is not a function 解决方法
  13. Python——pyqt5——智能提示(lineEdit/conmbobox)
  14. NFS 安装与配置
  15. Powershell 脚本判断制定路径下文件是否存在(来源于网络-转载)
  16. MT【32】内外圆(Apollonius Circle)的几何证明
  17. Python全栈-异常处理
  18. WEB开发库收集
  19. oracle上机实验内容
  20. 大猪蹄子队 Scrum meeting 合集

热门文章

  1. Linux: 正则表达式
  2. UVA10779Collectors Problem
  3. 用javascript写计算器
  4. Selenium WebDriver- 操作JavaScript的prompt弹窗(使用率低)
  5. MySQL5.7从入门到精通 (视频教学版) 刘增杰 编著
  6. day01_05.数学运算符
  7. Python全栈开发第二期课表
  8. python补漏----isinstance 和 issubclass
  9. onclick跳转到其他页面的几种方式
  10. rest-framwork官方文档教程(一)