3403: [Usaco2009 Open]Cow Line 直线上的牛
3403: [Usaco2009 Open]Cow Line 直线上的牛
Time Limit: 3 Sec Memory Limit: 128 MB
Submit: 71 Solved: 62
[Submit][Status]
Description
Input
Output
Sample Input
A L
A L
A R
A L
D R 2
A R
A R
D L 1
A L
A R
Sample Output
2
5
6
8
HINT
.jpg)
Source
题解:么么哒直接上数组和左右指针A之。。。(HansBug:论蒟蒻的刷水之路^_^)
var
i,j,k,l,m,n,f,r:longint;
a:array[..] of longint;
function getpx:longint;
var c1:char;i,j,k,l:longint;
begin
i:=;j:=;
repeat
read(c1);
if i= then
begin if c1='A' then i:= else if c1='D' then i:= end
else begin if c1='L' then j:= else if c1='R' then j:=; end;
until j>;
exit((i-)*+j);
end;
begin
readln(n);m:=;f:=;r:=;
for i:= to n do
begin
case getpx of
:begin inc(m);dec(f);a[f]:=m; end;
:begin inc(m);inc(r);a[r]:=m; end;
:begin read(j);inc(f,j); end;
:begin read(j);dec(r,j); end;
end;
readln;
end;
for i:=f to r do writeln(a[i]);
readln;
end.
3403: [Usaco2009 Open]Cow Line 直线上的牛的更多相关文章
- BZOJ 3403: [Usaco2009 Open]Cow Line 直线上的牛( deque )
直接用STL的的deque就好了... ---------------------------------------------------------------------- #include& ...
- 【BZOJ】3403: [Usaco2009 Open]Cow Line 直线上的牛(模拟)
http://www.lydsy.com/JudgeOnline/problem.php?id=3404 裸的双端队列.. #include <cstdio> #include <c ...
- BZOJ 3403: [Usaco2009 Open]Cow Line 直线上的牛(模拟)
直接双端队列模拟,完了= = CODE: #include<cstdio>#include<algorithm>#include<iostream>#include ...
- BZOJ3403: [Usaco2009 Open]Cow Line 直线上的牛
3403: [Usaco2009 Open]Cow Line 直线上的牛 Time Limit: 3 Sec Memory Limit: 128 MBSubmit: 48 Solved: 41[S ...
- B3403 [Usaco2009 Open]Cow Line 直线上的牛 deque
deque真的秀,queue和stack...没啥用了啊.操作差不多,就是在前面加一个front||back_就行了. 题干: 题目描述 题目描述 约翰的N只奶牛(编为1到N号)正在直线上排队 ...
- 149 Max Points on a Line 直线上最多的点数
给定二维平面上有 n 个点,求最多有多少点在同一条直线上. 详见:https://leetcode.com/problems/max-points-on-a-line/description/ Jav ...
- [Swift]LeetCode149. 直线上最多的点数 | Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. ...
- LeetCode:149_Max Points on a line | 寻找一条直线上最多点的数量 | Hard
题目:Max Points on a line Given n points on a 2D plane, find the maximum number of points that lie on ...
- lintcode 中等题:Max Points on a Line 最多有多少个点在一条直线上
题目 最多有多少个点在一条直线上 给出二维平面上的n个点,求最多有多少点在同一条直线上. 样例 给出4个点:(1, 2), (3, 6), (0, 0), (1, 3). 一条直线上的点最多有3个. ...
随机推荐
- VMware虚拟机出现Reason: Failed to lock the file
打开VMware出现Cannot open the disk *.vmdk or one of the snapshot disks it depends on.Reason: Failed to l ...
- Bootstrap入门(二十九)JS插件6:弹出框
Bootstrap入门(二十九)JS插件6:弹出框 加入小覆盖的内容,像在iPad上,用于存放非主要信息 弹出框是依赖于工具提示插件的,那它也和工具提示是一样的,是需要初始化才能够使用的 首先我们引入 ...
- HTML5常用标签分类
1.行级元素标签:a.span.sup.sub.em.b.big.i.strong 2.块元素标签:div.p.h1~h6.ul.ol.li.table.form.article.footer.hea ...
- POJ2185(KMP)
Milking Grid Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 7896 Accepted: 3408 Desc ...
- SDWebImage源码解读之SDWebImagePrefetcher
> 第十篇 ## 前言 我们先看看`SDWebImage`主文件的组成模块: 
Webpack 是一个模块打包器.它将根据模块的依赖关系进行静态分析,然后将这些模块按照指定的规则生成对应的静态资源. 因为本人也正在学习webpack ,所以此篇文章比较入门. 首先你想使用webp ...
- 【java设计模式】之 建造者(Builder)模式
我们还是举上一节的例子:生产汽车.上一节我们通过模板方法模式控制汽车跑起来的动作,那么需求是无止境的,现在如果老板又增加了额外的需求:汽车启动.停止.鸣笛引擎声都由客户自己控制,他想要什么顺序就什么顺 ...
- 私有成员的设置和访问方式——set()和get()方法
在定义类时,为了保证类中成员数据安全性及的封装性,防止成员数据值被任意修改,通常将类中成员属性用private进行修饰. 被private所修改的成员变量,只能在类中访问,跳出本类中,就无法直接访问. ...
- 各类编译器 allocator 底层
我们在c++中创建数组通常使用new来分配我们需要的内存大小,之后通过delete进行释放内存 但是我们调用new的时候,通过调用的是operator new,二operator new调用的是mal ...