Codequiry possesses an advanced plagiarism detection solution to perform a Moss Code plagiarism check. Our engine was designed to be able to detect up to 11 billion different web sources for evidence of plagiarism. We appreciate your visit to our website for more informationβ¦#include <stdio.h>
#include<stdlib.h>
#include<string.h>
int global_res=0;
char up(int x,int y,char* ptr,int col){
return (ptr+(col(y-1))+x);
}
char down(int x,int y,char* ptr,int col){
return (ptr+(col(y+1))+x);
}
char right(int x,int y,char* ptr,int col){
return (ptr+(coly)+x+1);
}
char left(int x,int y,char* ptr,int col){
return (ptr+(coly)+x-1);
}
void printing(char* ptr,int rows,int col){
int i;
for (i=0;i<rows;i++){
printf("%.s",col,ptr+i(col));
}
}
int path_exist(char* ptr,int row,int col,int x,int y){
ββββ*(ptr+(col*y)+x)='.';
ββββif ((right(x,y,ptr,col)=='X' || right(x,y,ptr,col)=='.') && (up(x,y,ptr,col)=='X' || up(x,y,ptr,col)=='.') && (down(x,y,ptr,col)=='X' || down(x,y,ptr,col)=='.') && (left(x,y,ptr,col)=='X' || left(x,y,ptr,col)=='.') ){
ββββ
ββββ return 0;
ββββ}
ββββif ((x==col || x==0 || y==0 || y==row) && ((*(ptr+(col*y)+x))!='X')){
ββββ
ββββ global_res=1;
ββββ return 1;
ββββ}
ββββif (*(ptr+(col*y)+x)=='X'){
ββββ
ββββ return 0;
ββββ}
βββ
ββββ
ββββ
ββββif(up(x,y,ptr,col)=='X'){
ββββ
ββββ if(right(x,y,ptr,col)!='X' && right(x,y,ptr,col)!='.'){
ββββ
ββββ path_exist(ptr,row,col,x+1,y);
ββββ }
ββββ else if(left(x,y,ptr,col)!='X' && left(x,y,ptr,col)!='.'){
ββββ path_exist(ptr,row,col,x-1,y);
ββββ }
ββββ else if(down(x,y,ptr,col)!='X' && down(x,y,ptr,col)!='.'){
ββββ path_exist(ptr,row,col,x,y+1);
ββββ }
ββββ
ββββ
ββββ }else if(up(x,y,ptr,col)!='.'){
ββββ path_exist(ptr,row,col,x,y-1);}
ββββ
ββββ
ββββ
ββββif(right(x,y,ptr,col)=='X' ){
ββββ if(up(x,y,ptr,col)!='X' && up(x,y,ptr,col)!='.') {
ββββ path_exist(ptr,row,col,x,y-1);
ββββ
ββββ }
ββββ else if(left(x,y,ptr,col)!='X' && left(x,y,ptr,col)!='.'){
ββββ path_exist(ptr,row,col,x-1,y);
ββββ
ββββ }
ββββ else if(down(x,y,ptr,col)!='X' && down(x,y,ptr,col)!='.'){
ββββ path_exist(ptr,row,col,x,y+1);
ββββ }
ββββ
ββββ}else if(right(x,y,ptr,col)!='.'){
ββββ path_exist(ptr,row,col,x+1,y);}
ββββ
ββββif(down(x,y,ptr,col)=='X' ){
ββββ
ββββ if(up(x,y,ptr,col)!='X' && up(x,y,ptr,col)!='.') {
ββββ path_exist(ptr,row,col,x,y-1);
ββββ
ββββ }
ββββ else if(left(x,y,ptr,col)!='X' && left(x,y,ptr,col)!='.'){
ββββ path_exist(ptr,row,col,x-1,y);
ββββ
ββββ }
ββββ else if(right(x,y,ptr,col)!='X' && right(x,y,ptr,col)!='.'){
ββββ path_exist(ptr,row,col,x+1,y);
ββββ
ββββ }
ββββ
ββββ}else if(down(x,y,ptr,col)!='.'){
ββββ path_exist(ptr,row,col,x,y+1);}
ββββ
ββββ if(left(x,y,ptr,col)=='X' ){
ββββ
ββββ
ββββ if(up(x,y,ptr,col)!='X' && up(x,y,ptr,col)!='.') {
ββββ path_exist(ptr,row,col,x,y-1);
ββββ
ββββ }
ββββ else if(down(x,y,ptr,col)!='X' && down(x,y,ptr,col)!='.'){
ββββ path_exist(ptr,row,col,x,y+1);
ββββ
ββββ }
ββββ else if(right(x,y,ptr,col)!='X' && right(x,y,ptr,col)!='.'){
ββββ path_exist(ptr,row,col,x+1,y);
ββββ
ββββ }
ββββ
ββββ
ββββ
ββββ}else if(left(x,y,ptr,col)!='.'){
ββββ path_exist(ptr,row,col,x-1,y);}
}
int path_star(char* ptr,int row,int col,int x,int y){
ββββif ((x*y)==(row*col)){
ββββ if (*(ptr+(col*y)+x)=='.'){
ββββ *(ptr+(col*y)+x)='*';}
ββββ return 0;
ββββ}
ββββif (x==col){
ββββ if (*(ptr+(col*y)+x)=='.'){
ββββ
ββββ *(ptr+(col*y)+x)='*';}
ββββ return path_star(ptr,row,col,0,y+1);
ββββ}
ββββelse if (*(ptr+(col*y)+x)=='.'){
ββββ *(ptr+(col*y)+x)='*';
ββββ return path_star(ptr,row,col,x+1,y);
ββββ}else{
ββββ return path_star(ptr,row,col,x+1,y);
ββββ}
}
int main() {
int x,y,length,l;
ββββchar *char_arr,*temp;
ββββint count=1;
βββ
βββ
ββββchar_arr=(char *) malloc(101*sizeof(char));
ββββscanf("%d %d",&x,&y);
ββββgetchar();
ββββfgets(char_arr,101,stdin);
ββββlength=strlen(char_arr);
ββββl=length;
ββββif (length<=100){
ββββ
ββββ temp=(char*) realloc(char_arr,(length+1)*2);
ββββ if (temp!=NULL){
ββββ char_arr=temp;
ββββ
ββββ
ββββ }
ββββ}
while (fgets(char_arr+length,l+1,stdin)!=NULL){
length+=strlen(char_arr+length);
temp=(char*) realloc(char_arr ,((length+1)*(count+2))*sizeof(char));
char_arr=temp;
count++;
}
path_exist(char_arr,count,l,x,y);
if (global_res==1){
path_star(char_arr,count,l,0,0);
}
printing(char_arr,count,l);
free(char_arr);
ββββ/* TODO: Implement here */
ββββ
ββββ
ββββreturn 0;
}