Codeforces Gym101606 A.Alien Sunset (2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017))
2024-08-24 07:17:24
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");
}
最新文章
- angular中的compile和link函数
- ios合并静态库
- Linux tcpdump 命令详解
- [Django_1_2]数据库设置
- C++ Interview - using new and delete to alloc and free memory
- JAVA编译中拒绝访问的问题及解决方案
- 在IIS上发布Web(使用VS2005)
- static 控件颜色修改
- 转Y-slow23原则(雅虎)
- python中的可变与不可变对象
- 在 HTML5 中捕获音频和视频
- webpack4: compilation.mainTemplate.applyPluginsWaterfall is not a function 解决方法
- Python——pyqt5——智能提示(lineEdit/conmbobox)
- NFS 安装与配置
- Powershell 脚本判断制定路径下文件是否存在(来源于网络-转载)
- MT【32】内外圆(Apollonius Circle)的几何证明
- Python全栈-异常处理
- WEB开发库收集
- oracle上机实验内容
- 大猪蹄子队 Scrum meeting 合集