---
# System prepended metadata

title: 12434 - Bacteria Widespread
tags: [array]

---

# 12434 - Bacteria Widespread
>author: Utin
###### tags: `array`

---

## Brief
See the code below

## Solution 0

```c=
#include<stdio.h>

int main() {
    int r, c, t;
	char arr[101][101];
	scanf("%d %d %d", &r, &c, &t);
	for(int i=0; i<r; i++) {
		for(int j=0; j<c; j++) {
			scanf("\r%c", &arr[i][j]);
		}
	}
	for(int times=0; times<t; times++) {
		for(int i=1; i<r-1; i++) {
			for(int j=1; j<c-1; j++) {
				if(arr[i][j] == 'F') {
					if(arr[i+1][j] == 'C') arr[i+1][j] = 'f';
					if(arr[i-1][j] == 'C') arr[i-1][j] = 'f';
					if(arr[i][j+1] == 'C') arr[i][j+1] = 'f';
					if(arr[i][j-1] == 'C') arr[i][j-1] = 'f';
				}
			}
		}
		for(int i=1; i<r-1; i++) {
			for(int j=1; j<c-1; j++) {
				if(arr[i][j] == 'f') arr[i][j] = 'F';
			}
		}
	}
	for(int i=0; i<r; i++) {
		for(int j=0; j<c; j++) {
			printf("%c", arr[i][j]);
		}
		printf("\n");
	}
}
// By Utin
```

## Reference