41 lines
648 B
C
41 lines
648 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
void draw(int ops, int x)
|
|
{
|
|
if ( (ops) % 40 <= x + 2 && (ops) % 40 >= x )
|
|
{
|
|
printf("#");
|
|
} else {
|
|
printf(".");
|
|
}
|
|
if ((ops) % 40 == 0) {
|
|
printf("\n");
|
|
}
|
|
}
|
|
|
|
int main()
|
|
{
|
|
char *line = NULL;
|
|
size_t len;
|
|
int ops = 1;
|
|
int x = 1;
|
|
|
|
int signal = 0;
|
|
|
|
while (getline(&line, &len, stdin) != -1)
|
|
{
|
|
draw(ops, x);
|
|
if (line[0] == 'a') {
|
|
ops++;
|
|
draw(ops, x);
|
|
int a = atoi(line+5);
|
|
x += a;
|
|
// printf("%d\n", a);
|
|
}
|
|
ops++;
|
|
}
|
|
|
|
printf("%d\n", signal);
|
|
}
|