UVa 457 - Linear Cellular Automata
来源:互联网 发布:初中数学出题软件 编辑:程序博客网 时间:2024/05/04 22:33
13583110457Linear Cellular AutomataAcceptedANSI C0.0122014-05-03 21:48:27【问题描述】
翻译见http://www.nocow.cn/index.php/UVA/457
【解决过程】
代码如下:
#include<stdio.h>char con(int c){if(c==0) return ' '; elseif(c==1) return '.'; elseif(c==2) return 'x'; else return 'W';}int main(){int i,n;scanf("%d",&n);for(i=1;i<=n;i++){int j,k,DNA[10],dish[50][42]={{0}};for(j=0;j<=9;j++) scanf("%d",&DNA[j]);dish[0][20]=1;for(j=0;j<50;j++){for(k=1;k<=40;k++)printf("%c",con(dish[j][k]));if(j<49) for(k=1;k<=40;k++)dish[j+1][k]=DNA[dish[j][k-1]+dish[j][k]+dish[j][k+1]];printf("\n");}if(i<n) printf("\n");}return 0;}
【教训】
1、一定要注意数组的范围!
0 0
- UVa 457 - Linear Cellular Automata
- uva-457-Linear Cellular Automata
- UVA 457 - Linear Cellular Automata
- UVA 457 - Linear Cellular Automata
- UVA 457 - Linear Cellular Automata
- uva 457 Linear Cellular Automata
- UVa 457 - Linear Cellular Automata
- UVa 457 - Linear Cellular Automata
- UVA 457 Linear Cellular Automata
- UVA - 457 Linear Cellular Automata
- UVA-457-Linear Cellular Automata
- UVA - 457 Linear Cellular Automata
- uva Linear Cellular Automata
- UVA OJ 457 - Linear Cellular Automata
- UVa 457 Linear Cellular Automata (water ver.)
- UVa - 457 - Linear Cellular Automata 题解
- uva 457 Linear Cellular Automata(模拟)
- UVA - 457 Linear Cellular Automata(水题)
- 数据库存储过程
- JAVA SMTP SSL&TSL
- 数据库测试
- Silverlight 调用GP服务第一篇之发布GP服务(Geoprocessing Service)
- 用友面试经历
- UVa 457 - Linear Cellular Automata
- MVC 过滤器
- [codility]Distinct
- QT透明显示文字
- HDU 3038 How Many Answers Are Wrong (带权并查集+区间判断)
- jquery mobile 学习笔记——listview
- JAVA WEB将数据插入SQL的乱码问题
- js实现table排序(jQuery下的jquery.sortElements)
- linux 编译指定库、头文件的路径问题