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 旋转卡壳模板题.然后敲错了. 代码是另 ...
随机推荐
- 【jquery】 form ajaxSubmit 问题
常见问题 这个插件跟哪些版本的jQuery兼容? 这个插件需要jQuery v1.0.3 或 以后的版本. 这个插件需要其它插件的支持吗? 不需要. 这个插件的运行效率高吗? 是的!请到 对比页面 查 ...
- LeetCode(228) Summary Ranges
题目 Given a sorted integer array without duplicates, return the summary of its ranges. For example, g ...
- LeetCode(120) Triangle
题目 Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacen ...
- Persona5
65536K Persona5 is a famous video game. In the game, you are going to build relationship with your ...
- 持续化集成Jenkins的系统配置
最近在研究selenium2自动化测试,用到持续化集成jenkins.由于之前仅限于使用,而没有真正动手配置过,所以现在学习从零开始,搭建持续化集成,故而有了这篇博客. 先介绍一下项目持续集成测试,这 ...
- bash循环for/while/until
shell流程控制之一:for循环 for VAR in LIST; do STATEMENT1 ... done 例: ...
- JavaScript 将当地时间转换成其它时区
毫无疑问,用JavaScript脚本可以通过直接查看用户的时钟,方便地在网页上显示本地时间. 但是,如果你想显示不同地区的时间—--例如,如果你的本部在别的国家,你想查看“本国”时间而非当地时间,又该 ...
- tarjan - SPFA - Luogu 3387【模板】缩点
[模板]缩点 题目描述 给定一个n个点m条边有向图,每个点有一个权值,求一条路径,使路径经过的点权值之和最大.你只需要求出这个权值和. 允许多次经过一条边或者一个点,但是,重复经过的点,权值只计算一次 ...
- python - 读取配置文件
# -*- coding:utf-8 -*- ''' @project: jiaxy @author: Jimmy @file: read_config.py @ide: PyCharm Commun ...
- linux快速查看同局域网的其他在线主机
安装一个nmap工具,直接 nmap -sP 192.168.1.1/24 即可