Codeforces Gym101606 A.Alien Sunset (2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017))
2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017)
寒假第一次组队训练赛,和学长一起训练,题目难度是3颗星,我和猪队友写了6题,第二次训练赛,题目难度2颗星,写出了8道题,两次比赛都不是第一,差一点,很伤。
这是第一次训练的题解,第二次的在上一篇博客,本来不想今天写题解的,但是明天又有新的训练。
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");
}
Codeforces Gym101606 A.Alien Sunset (2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017))的更多相关文章
- [寒假集训第一场]gym101606 2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017)
3星场 难度在于英文题面太难读懂了QAQ 看样例猜题意的我 博客园的c++主题真丑 A Alien Sunset \(description\) 有\(n\)个星球,每个星球自转时间不一样,所以一天的 ...
- 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){ ...
- 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< ...
- 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< ...
- 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< ...
- Codeforces Gym101606 E.Education (2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017))
E Education 这个题有点意思,就是找满足条件的最小价格里的最大值的人数,有点贪心的思想吧,一开始写错了,人群的那个不能排序,而且是最小价格里找能住下人最多的部门,让这个部门去住这个房间.在循 ...
- Codeforces Gym101606 D.Deranging Hat (2017 United Kingdom and Ireland Programming Contest (UKIEPC 2017))
D Deranging Hat 这个题简直了,本来想的是冒泡排序然后逆着输出来的,后来发现不对,因为题目上求的是最优解,而且冒泡的话,输出结果有的超出10000行了,所以就是把一开始的,排好序的字母标 ...
- 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/ ...
- 2017 United Kingdom and Ireland Programming(Gym - 101606)
题目很水.睡过了迟到了一个小时,到达战场一看,俩队友AC五个了.. 就只贴我补的几个吧. B - Breaking Biscuits Gym - 101606B 旋转卡壳模板题.然后敲错了. 代码是另 ...
随机推荐
- LeetCode(283)Move Zeroes
题目 Given an array nums, write a function to move all 0's to the end of it while maintaining the rela ...
- AD采样求平均STM32实现
iADC_read(, &u16NTC_1_Sample_Val_ARR[]); == ui8FirstSampleFlag) { ; i<; i++) { u16NTC_1_Sampl ...
- Linux学习-备份策略
每部主机的任务都不相同,重要的数据也不相同,重要性也不一样,因此,每个人的备份思考角度都不一样! 备份分为两大部分,一个是每日备份经常性变动的重要数据, 一个则是每周备份就不常变动的信息.这个时候我就 ...
- VS2017生成.net core项目报错:The current .NET SDK does not support targeting .NET Core 2.1. Either
今天在生成一个项目的时候,生成报错,错误如下:The current .NET SDK does not support targeting .NET Core 2.1. Either target ...
- 光学字符识别OCR-4
经过第一部分,我们已经较好地提取了图像的文本特征,下面进行文字定位. 主要过程分两步: 1.邻近搜索,目的是圈出单行文字: 2.文本切割,目的是将单行文本切割为单字. ...
- NHibernate N+1问题实例分析和优化
1.问题的缘起 考察下面的类结构定义 public class Category { string _id; Category _parent; IList<Category> _chil ...
- python + selenium - selenium简介
1. 产品简介 selenium 是 基于 web网页的UI自动化测试框架. 1)支持多浏览器操作:ie.chrome.firefox.edge.safaria等 2)跨平台:windows.linu ...
- [Offer收割]编程练习赛48
题目1 : 折线中点 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定平面上N个点P1, P2, ... PN,将他们按顺序连起来,形成一条折线. 请你求出这条折线的 ...
- DS博客作业06--图
1.本周学习总结 1.1.思维导图 1.2.谈谈你对图结构的认识及学习体会 本章学习了图结构的相关知识,图形结构属于复杂的非线性数据结构,在实际应用中很多问题可以用图来描述.在图结构中,每个元素可以有 ...
- 群论 - Group Theory
群的定义 若非空集合\(G\)和定义在\(G\)上的二元运算\(⋅\)构成的代数结构\((G,⋅)\),满足: 封闭性:\(\forall a,b\in G\),有\(a⋅b\in G\). 结合律: ...