A. Gabriel and Caterpillar

题意: 就是说  一个小孩子去观察毛毛虫从 h1的地方爬到h2的地方、毛毛虫从10点爬到22点、每小时爬的距离是a, 晚上22点到第二天早上10点 毛毛虫休息 每小时下落b距离、但是最初状态是那个小孩子从14点开始观察毛毛虫的, 必须过了24点才算一天

思路:模拟、但细节地方要注意

hint:但你要知道什么情况下永远也爬不上去,就是说每小时下落比每小时上升的距离大呢,但这还有个细节, 就是即使b>a 但毛毛虫是先可以爬10个小时,如果在这10个小时内爬到了h2 也就是说 及时b>a它也可以爬到

 #include<iostream>
#include<cstdio>
#include<cmath>
int main()
{
int n,m;
int a,b;
while(~scanf("%d%d%d%d",&n,&m,&a,&b)){
int ans=m-n;
int flag=; //标记变量、记录是否能爬到终点
int distance=;
int time=;
distance+=a*;
if(distance<ans){
while(){
distance-=b*; //休息
++time; // 休息时间过了24点、 所以算一天
distance+=a*;
if(distance>=ans) break;
if(b>=a){ //直接在循环里面判断、 因为前面可以爬的10小时可以到终点的话
flag=; // 也就不会进循环了
break;
}
}
}
if(!flag) printf("-1\n");
else printf("%d\n",time);
}
}

B. z-sort

题意:先给你一个数列、问用着数列的数是否可以组成一个 对于数列中每一个偶数项 存在ai ≥ ai - 1、对于每一个奇数项 存在ai ≤ ai - 1思路:我是这样想的、既然要满足两个条件、 那么对于从前到后的奇数项来说是一个非递减的,对前到后的偶数项来说是一个非递增的、

那么对于所给的数列、 排一个序,然后贪心,具体看代码吧

  

 #include<cmath>
#include<cstring>
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int num[];
int main()
{
int n;scanf("%d",&n);
for(int i=;i<=n;++i)
scanf("%d",&num[i]);
sort(num+,num+n+);
int ans[];
int add,dre;
add=;
dre=n;
for(int i=;i<=n;++i) //构造这样一个数列
if(i%==)
ans[i]=num[dre--];
else
ans[i]=num[add++];
int flag=;
// for(int i=1;i<=n;++i)
// printf("%d ",ans[i]);
// printf("\n");
for(int i=;i<=n;++i) //判断构造的数列是否满足条件
if(i%==){
if(ans[i]<ans[i-]) flag=;
}
else
if(ans[i]>ans[i-]) flag=;
if(!flag) printf("Impossible");
else for(int i=;i<=n;++i) printf("%d ",ans[i]);
printf("\n");
return ;
}

C  D 题意其实都看懂了、  就是做不出来     好气好气阿,

读题方面比以前好一点了、

继续努力吧、

Educational Codeforces Round 10 A B题、的更多相关文章

  1. Educational Codeforces Round 10 C. Foe Pairs 水题

    C. Foe Pairs 题目连接: http://www.codeforces.com/contest/652/problem/C Description You are given a permu ...

  2. Educational Codeforces Round 10

    A:Gabriel and Caterpillar 题意:蜗牛爬树问题:值得一提的是在第n天如果恰好在天黑时爬到END,则恰好整除,不用再+1: day = (End - Begin - day0)/ ...

  3. Educational Codeforces Round 10 A. Gabriel and Caterpillar 模拟

    A. Gabriel and Caterpillar 题目连接: http://www.codeforces.com/contest/652/problem/A Description The 9-t ...

  4. Educational Codeforces Round 23 A-F 补题

    A Treasure Hunt 注意负数和0的特殊处理.. 水题.. 然而又被Hack了 吗的智障 #include<bits/stdc++.h> using namespace std; ...

  5. Educational Codeforces Round 10 D. Nested Segments (树状数组)

    题目链接:http://codeforces.com/problemset/problem/652/D 给你n个不同的区间,L或者R不会出现相同的数字,问你每一个区间包含多少个区间. 我是先把每个区间 ...

  6. CF Educational Codeforces Round 10 D. Nested Segments 离散化+树状数组

    题目链接:http://codeforces.com/problemset/problem/652/D 大意:给若干个线段,保证线段端点不重合,问每个线段内部包含了多少个线段. 方法是对所有线段的端点 ...

  7. Educational Codeforces Round 10 D. Nested Segments 离线树状数组 离散化

    D. Nested Segments 题目连接: http://www.codeforces.com/contest/652/problem/D Description You are given n ...

  8. Educational Codeforces Round 10 B. z-sort 构造

    B. z-sort 题目连接: http://www.codeforces.com/contest/652/problem/B Description A student of z-school fo ...

  9. Educational Codeforces Round 10 D. Nested Segments 【树状数组区间更新 + 离散化 + stl】

    任意门:http://codeforces.com/contest/652/problem/D D. Nested Segments time limit per test 2 seconds mem ...

随机推荐

  1. go struct 工厂

  2. 2019-1-29-Sublime-Text-安装中文、英文字体

    title author date CreateTime categories Sublime Text 安装中文.英文字体 lindexi 2019-01-29 16:35:25 +0800 201 ...

  3. python 切片索引

  4. check constraints

    SELECT constraint_name, constraint_type, column_name, STATUSfrom user_constraints natural join user_ ...

  5. 【水滴石穿】ReactNativeMobxFrame

    项目地址如下:https://github.com/FTD-ZF/ReactNativeMobxFrame 应该可以说的是,项目也只是一个花架子,不过底部的tab稍微改变了 我们一起来看代码 //in ...

  6. 大数据技术之Kafka

    Kafka概述 1.1 消息队列     (1)点对点模式(一对一,消费者主动拉取数据,消息收到后消息清除) 点对点模型通常是一个基于拉取或者轮询的消息传送模型,这种模型从队列中请求信息,而不是将消息 ...

  7. javascript如何将时间戳转为24小时制

    var now = new Date(parseInt(1446634507) * 1000);console.log(now.toLocaleString('chinese',{hour12:fal ...

  8. weixin 微信开放平台 微信公众平台

    官网地址入口 微信小程序 https://mp.weixin.qq.com/ appid and openid not match 1.appid :是公众号的ID. 2.openid:关注公众号生成 ...

  9. MyBatis动态SQL(二)

    1.foreach foreach语句用来遍历数组和集合对象.标签中的属性: collection属性:值有三种list.array.map open属性:表示调用的sql语句前缀添加的内容 clos ...

  10. Python中基于socketserver实现并发的socket

    1.基于TCP协议: 服务端: import socketserver class MyHandler(socketserver.BaseRequestHandler): def handle(sel ...