No older revisions available
No older revisions available
~cpp
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int array[100][100] = {0};
ifstream fin("input.txt");
int i;
fin>>i;
int x,y;
fin>>x;
fin>>y;
array[y][x]++;
char ch[100];
fin>>ch;
for(int j=0; j<strlen(ch); j++)
{
if (ch[j]=='1')
{
x=x+1; y=y-1;
}
if (ch[j]=='2')
{
x=x+1;
}
if (ch[j]=='3')
{
x=x+1; y=y+1;
}
if (ch[j]=='4')
{
y=y+1;
}
if (ch[j]=='5')
{
x=x-1; y=y+1;
}
if (ch[j]=='6')
{
x=x-1;
}
if (ch[j]=='7')
{
x=x-1; y=y-1;
}
if (ch[j]=='0')
{
y=y-1;
}
array[y][x]++;
}
for(int a=0; a<i; a++)
{
for(int b=0; b<i; b++)
cout<<array[a][b]<<" ";
cout<<"\n";
}
return 0;
}