Page 1 of 1

### 12405 - Scarecrow

Posted: Sun Jan 08, 2012 4:45 am
please give me some sample input & output...
I got WA 3 times

### Re: 12405

Posted: Sun Jan 08, 2012 8:55 am

Code: Select all

``````8
5
.....
5
..*..
10
....##..#.
10
.....#....
9
....#....
12
....#....#..
10
..#..##...
13
..#..##....#.
``````

### 12405

Posted: Sun Jan 08, 2012 2:26 pm
#include<stdio.h>
#include<math.h>
#include<string.h>

int main()
{
char inp[500];
int test,i,k,cnt,t,n,j;
char ch;
scanf("%d",&test);
for(t=1;t<=test;t++)
{
memset(inp,0,sizeof(inp));
scanf("%d",&n);
scanf("%s",&inp);
cnt=0;
for(i=0;i<n;i++)
{
if(inp=='.' || inp=='#')
{
if((inp[i-1]=='.' && i>=0) && (inp[i+1]=='.' && i<n))
{
inp='1';
inp[i-1]='1';
inp[i+1]='1';
cnt++;
}
}
}
for(i=0;i<n;i++)
{
if(inp=='.')
{
if((inp[i-1]=='.' && i>=0))
{
inp='1';
inp[i-1]='1';
cnt++;
}
else if((inp[i+1]=='.' && i<n))
{
inp='1';
inp[i+1]='1';
cnt++;
}
else
{
cnt++;
}
}
}
printf("Case %d: %d\n",t,cnt);
}
return 0;
}

pls check whtz wrng with this one....I dont understand.
Thanks..

### Re: 12405

Posted: Tue Jan 10, 2012 9:36 am
Hello, try this input...
I think ur code does not work for this input..think easily, its a easy problem
2
10
..#..##...
13
..#..##....#.

out:
Case 1: 3
Case 2: 4

ASU(SUST)

### Re: 12405

Posted: Mon Jan 16, 2012 8:14 pm
output for plamplam's input

Code: Select all

``````Case 1: 2
Case 2: 2
Case 3: 4
Case 4: 4
Case 5: 3
Case 6: 4
Case 7: 3
Case 8: 4
``````

### Re: 12405

Posted: Thu Jun 28, 2012 1:24 pm
Generator by: Jane Alam Jan
http://www.LightOj.com
Sample Input: (By Generator)

Code: Select all

``````49
3
...
11
...##....##
2
##
42
..#.#...#.........#.#..#..#.......#.......
40
.#...#.#........#...#.#.##.........#..#.
46
#.#.##.............#.......##.....#...#.....#.
62
.#...............#.....##.....#.#......#.##.#.##......##..#.#.
87
......#..#..#..###...........##..##......#..#.......##...#.#.......##.......##..##....#
37
.......#...##....#.##.....#.#.....#..
77
......#..#.....#.......###..#.....##.......#.#..#........#..........#..#.....
94
....##..#.......#.#...#....#...##.#.......##...#..#..#........#.#.##.#.....#...#..........#.#.
14
.#....##.#....
76
..#.##.#...#......#...#.#.#....##.#.#.#.##...##........#..#.#.......##...#..
44
..#......#........................#.#..#.#..
56
.....#.#.#.#..#...##...##.........##...#.#....##..#.....
56
.......##.#..#.#......#........##....#.#........##.#...#
24
......#.#.#....###......
63
#...#..#......#.##...#.....##.#.......##....#........##.#....##
26
....#..#...##...###.......
73
.........###......###...###.....#.#.....#...#......#.....##..........#...
31
....#.#......##....#.#........#
20
##..#....##.#.......
40
#.#......##..#.#...##....##....#....#...
11
..#.....##.
58
.##..##..##.#.....#.#.........#.....#........##..##.#....#
83
..#.#.....###....#......#........#...#...#.........#...#.#.....#..#.##..#.#.#.##.#.
10
........#.
32
.#....#....##..#......#...#.#..#
79
#............##.##..#.#...#......#.#.##......#.#...##..#..#......##.#.#....#..#
2
#.
44
.....#...#........##.......#................
57
...#....##...............#.........#.###.#.....#.##.#.##.
9
.##......
63
##.....#....#..##.....#.#.#.#...#..#........#..#........####.#.
90
..#.....#...###....##.#.##.#.##...........##...........#..#..##...#....#..#....#...#......
49
##.......#........#.............##.............#.
2
..
30
...#.#..#.......#.#....#..#...
96
....#.#.#........#.............#..##.....##.#......#...#.#..#.#.....##.#.......#......#...#..#..
98
#.#....#..#..#...#.....#.........##...#.#.#..###..#.#.##......#...#.##...#.#.#.#....##..####..#...
90
#.##....#.#.#..##......##.#.........#......#.......#..#..##.......#.#..#..............#.#.
79
.................##.##...#...#............#.......#.....#...#...#..........#...
85
....##..##....#.#....##....#...#....#.#..###..#...#.....#...........#...#.........#..
69
...............##.......#.......#.#...............#..#..#.....#..#..#
7
..#....
91
.#..................#......#...#....#.......#.#....#......#...##....#.........#....#....#.#
9
#.##.#.#.
5
.....
48
#.....#..#.....#....#..#.##..#.....#..#.........
``````
Sample Output: (AC code)

Code: Select all

``````Case 1: 1
Case 2: 3
Case 3: 0
Case 4: 14
Case 5: 13
Case 6: 14
Case 7: 19
Case 8: 26
Case 9: 12
Case 10: 25
Case 11: 29
Case 12: 4
Case 13: 22
Case 14: 14
Case 15: 16
Case 16: 17
Case 17: 7
Case 18: 18
Case 19: 8
Case 20: 21
Case 21: 9
Case 22: 6
Case 23: 12
Case 24: 4
Case 25: 17
Case 26: 25
Case 27: 4
Case 28: 10
Case 29: 23
Case 30: 1
Case 31: 14
Case 32: 17
Case 33: 3
Case 34: 19
Case 35: 26
Case 36: 15
Case 37: 1
Case 38: 9
Case 39: 29
Case 40: 26
Case 41: 28
Case 42: 25
Case 43: 26
Case 44: 22
Case 45: 3
Case 46: 28
Case 47: 3
Case 48: 2
Case 49: 15
``````