3406: [Usaco2009 Oct]Invasion of the Milkweed 乳草的入侵
3406: [Usaco2009 Oct]Invasion of the Milkweed 乳草的入侵
Time Limit: 3 Sec Memory Limit: 128 MB
Submit: 87 Solved: 49
[Submit][Status][Discuss]
Description
Input
Output
Sample Input
....
..*.
.**.
Sample Output
HINT
Source
- /**************************************************************
- Problem:
- User: HansBug
- Language: Pascal
- Result: Accepted
- Time: ms
- Memory: kb
- ****************************************************************/
- const dir:array[..,..] of longint=((,),(-,),(,),(,-),(,),(-,-),(-,),(,-));
- var
- i,j,k,l,m,n,x,y,x0,y0,f,r:longint;
- a:array[..,..] of longint;
- d:array[..,..] of longint;
- ch:char;
- begin
- readln(m,n,y,x);x:=n+-x;
- for i:= to n+ do
- begin
- a[i,m+]:=;
- a[i,]:=;
- end;
- for i:= to m+ do
- begin
- a[n+,i]:=;
- a[,i]:=;
- end;
- for i:= to n do
- for j:= to m do
- begin
- read(ch);
- if ch='.' then a[i,j]:= else a[i,j]:=;
- if j=m then readln;
- end;
- d[,]:=x;d[,]:=y;d[,]:=;f:=;r:=;
- while f<r do
- begin
- for i:= to do
- begin
- x0:=d[f,]+dir[i,];
- y0:=d[f,]+dir[i,];
- if a[x0,y0]= then
- begin
- d[r,]:=x0;
- d[r,]:=y0;
- d[r,]:=d[f,]+;
- inc(r);a[x0,y0]:=;
- end;
- end;
- inc(f);
- end;
- writeln(d[f-,]);
- readln;
- end.
3406: [Usaco2009 Oct]Invasion of the Milkweed 乳草的入侵的更多相关文章
- 乳草的入侵//BFS
P1030 乳草的入侵 时间: 1000ms / 空间: 131072KiB / Java类名: Main 背景 USACO OCT09 6TH 描述 Farmer John一直努力让他的草地充满鲜美 ...
- [TYVJ] P1030 乳草的入侵
乳草的入侵 背景 Background USACO OCT09 6TH 描述 Description Farmer John一直努力让他的草地充满鲜美多汁的而又健康的牧草.可惜天不从人愿,他在植物 ...
- TYVJ P1030 乳草的入侵 Label:跳马问题
背景 USACO OCT09 6TH 描述 Farmer John一直努力让他的草地充满鲜美多汁的而又健康的牧草.可惜天不从人愿,他在植物大战人类中败下阵来.邪恶的乳草已经在他的农场的西北部份佔领了一 ...
- BZOJ 3406 乳草的入侵
BFS. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm&g ...
- Tyvj 1030 乳草的入侵
以一个简单的BFS对基础搜索做一个收尾好了. 给一个草,然后以这棵草为九宫格的中心,每周向周围八个方向扩散,问多少个星期能把这个农场占满. 遍历整个map,最后一个出队列的对应的星期数就是所求. // ...
- [USACO09OCT]Invasion of the Milkweed】乳草的侵占-C++
Farmer John一直努力让他的草地充满鲜美多汁的而又健康的牧草.可惜天不从人愿,他在植物大战人类中败下阵来.邪恶的乳草已经在他的农场的西北部份占领了一片立足之地. 草地像往常一样,被分割成一个高 ...
- 洛谷 P2960 [USACO09OCT]Milkweed的入侵Invasion of the Milkweed
P2960 [USACO09OCT]Milkweed的入侵Invasion of the Milkweed 题目描述 Farmer John has always done his best to k ...
- BZOJ 3408: [Usaco2009 Oct]Heat Wave 热浪( 最短路 )
普通的最短路...dijkstra水过.. ------------------------------------------------------------------------------ ...
- BZOJ 3407: [Usaco2009 Oct]Bessie's Weight Problem 贝茜的体重问题( dp )
01背包... ----------------------------------------------------------------------- #include<cstdio&g ...
随机推荐
- RAC执行root.sh报libcap.so.1: cannot open shared object file
Failed to create keys in the OLR, rc = 127, Message: /opt/app/11.2.0/grid/bin/clscfg.bin: error whil ...
- HTML5 Canvas、内联 SVG、Canvas vs. SVG
canvas 元素用于在网页上绘制图形. 什么是 Canvas? HTML5 的 canvas 元素使用 JavaScript 在网页上绘制图像. 画布是一个矩形区域,您可以控制其每一像素. canv ...
- Java Ant Could not find the main class: org.eclipse.ant.internal.launching.remote.InternalAntRunner. Program
参考:http://blog.csdn.net/jiangtaoking/article/details/49151763 The solution is to go to Run as → Exte ...
- 常用的.net开源项目
Json.NET http://json.codeplex.com/ Json.Net 是一个读写Json效率比较高的.Net框架.Json.Net 使得在.Net环境下使用Json更加简单.通过Li ...
- Canvas drawImage API
drawImage <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...
- 设计模式之单一职责原则(SRP)
自己之前写过一些关于设计模式的博客,但是大部分都写得比较匆忙.现在正好趁年前有时间,笔者打算好好地整理一下自己这块知识结构.开篇的第一个原则就是设计原则里面最简单的一个原则--单一职责原则. 想必大家 ...
- java文件上传(单文件 多文件)与删除
/** * 文件上传--单文件 * * @param request * @param response * @param path * 文件存放路径(path为WebApp\后面的内容) * @re ...
- arm交叉编译器科普
交叉编译工具链的命名规则为:arch [-vendor] [-os] [-(gnu)eabi] arch - 体系架构,如ARM,MIPS vendor - 工具链提供商 os - 目标操作系统 ea ...
- HDU 3782 xxx定律
xxx定律 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...
- TypeScript和JavaScript哪种语言更先进
TypeScript和JavaScript哪种语言更先进 近两年来最火爆的技术栈毫无争议的是JavaScript,随着ES6的普及,不管是从前端的浏览器来看,还是后端的NodeJS场景,JavaScr ...