poj 1120 A New Growth Industry 模拟
来源:互联网 发布:银河麒麟linux下载 编辑:程序博客网 时间:2024/06/08 11:25
//poj 1120//sep9#include <iostream>using namespace std;const int SIZE=20;int D[SIZE+4],mat[SIZE+4][SIZE+4],sum[SIZE+4][SIZE+4];int dx[4]={0,0,-1,1};int dy[4]={-1,1,0,0};char ch[4]={'.','!','X','#'};int main(){int days;scanf("%d",&days);for(int i=0;i<16;++i)scanf("%d",&D[i]);for(int i=0;i<SIZE;++i)for(int j=0;j<SIZE;++j)scanf("%d",&mat[i][j]);while(days--){for(int i=0;i<SIZE;++i)for(int j=0;j<SIZE;++j){sum[i][j]=mat[i][j];for(int k=0;k<4;++k){int nx=i+dx[k];int ny=j+dy[k];if(nx>=SIZE||nx<0||ny>=SIZE||ny<0)continue;sum[i][j]+=mat[nx][ny];}}for(int i=0;i<SIZE;++i)for(int j=0;j<SIZE;++j){mat[i][j]+=D[sum[i][j]];mat[i][j]=max(mat[i][j],0);mat[i][j]=min(mat[i][j],3);}}for(int i=0;i<SIZE;++i){for(int j=0;j<SIZE;++j){printf("%c",ch[mat[i][j]]);}puts("");}return 0;}
阅读全文
0 0
- poj 1120 A New Growth Industry 模拟
- HDOJ1057 A New Growth Industry 【模拟】
- ACM篇:POJ 1120--A New Growth Industry
- POJ 1120 A New Growth Industry 已被翻译
- A New Growth Industry
- HDU ACM 1057 A New Growth Industry 简单模拟
- zoj1051 A New Growth Industry
- ZOJ1051 A New Growth Industry
- JOJ1086: A New Growth Industry
- ZOJ1051 A New Growth Industry
- ZOJ1051 A New Growth Industry
- Zoj1051 A New Growth Industry
- zoj1051--------A New Growth Industry 细菌~
- ZOJ 1051 A New Growth Industry
- ZOJ 1051 A New Growth Industry
- HDU 1051 A New Growth Industry
- hdu 1057 A New Growth Industry
- ZOJ 1051 A New Growth Industry
- 使用hammer.js实现移动端webAPP手势滑动切换页面
- 二叉树的所有路径
- 解读pixhawk加速度计校准代码
- [LINUX]批量替换字符串
- Oracle密码过期the password has expired
- poj 1120 A New Growth Industry 模拟
- C++各种常见排序算法
- 细说反射,Java 和 Android 开发者必须跨越的坎
- 【PAT】【Advanced Level】1010. Radix (25)
- CodeForces 575 A.Fibonotci(矩阵快速幂+线段树)
- VMware虚拟机备份和恢复
- 系统类,系统分类和自定义分类优先级
- C primer plus(编程练习)file-3.11-3
- HDFS常用命令