uva 457 Linear Cellular Automata(模拟)
来源:互联网 发布:数据库程序设计 编辑:程序博客网 时间:2024/04/30 04:41
uva 457 Linear Cellular Automata
英语。。。。
题意:40个培养基,开始时只有20号为1,其他全部为0。
一个培养基会影响隔壁两个培养基。
假设1号左边无穷远处有一个培养基为0,40号右边无穷远处也有一个培养基为0。
给出一个DNA序列,元素均不大于3。
求50天培养基的变化。
每天某个培养基的变化是 x=a[j-1]+a[j]+a[j+1], DNA[x]。
每过一天培养基变化为DNA[x]。
用' '代表0,'.'代表1,'x'代表2,'W'代表3。
代码:
#include<stdio.h>int main(){ int DNA[10]; int dish[42]; int ncase; scanf("%d", &ncase); while(ncase--) { for(int i = 0; i < 10; i++) { scanf("%d", &DNA[i]); } for(int i = 0; i < 42; i++) { dish[i] = 0; } dish[20] = 1; printf(" . \n"); for(int i = 1; i < 50; i++) { int previous = 0; for(int j = 1; j <= 40; j++) { int temp = dish[j]; dish[j] = DNA[previous + dish[j] + dish[j + 1]]; previous = temp; switch(dish[j]) { case 0: printf(" "); break; case 1: printf("."); break; case 2: printf("x"); break; case 3: printf("W"); break; } } printf("\n"); } if(ncase != 0) printf("\n"); } return 0;}
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-457-Linear Cellular Automata
- UVA - 457 Linear Cellular Automata
- uva Linear Cellular Automata
- UVa 457 Linear Cellular Automata(线性细胞自动机)
- UVA OJ 457 - Linear Cellular Automata
- UVa 457 Linear Cellular Automata (water ver.)
- POJ 3259 Wormholes (Bellman)
- OpenGL绘图的基本过程是:清除缓冲区,设置当前颜色,绘制几何图元,输出图形。
- DHCP协议和dhcpcd源码分析
- 聚类算法K-Means, K-Medoids, GMM, Spectral clustering,Ncut
- NOJ [1015] 一个简单的问题
- uva 457 Linear Cellular Automata(模拟)
- 浅谈IM软件如何建立安全socket连接、登录
- php 模拟登陆
- Java 中的printStackTrace()方法
- 新创建对象的ob_refcnt为啥就等于2?
- 一步一步认识C++STL中的迭代器
- ccDraw对于alpha无效的解决办法
- 猜数字游戏
- swift一览之 泛型