#include int verifica(int mat[100][100] , int v[], int n, int m, int nv, int i1,int j1); int main(){ int mat[100][100]={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}; int v[]={7,8,9,10,11}; int n=4; int m=4; int nv=5; FILE * fp; int k=0; int contenuto; contenuto=0; while(k<(n*m-nv)&&!contenuto) { contenuto=verifica(mat,v, n, m, nv, k/m,k%m); k++; } fp = fopen("risultato.txt","w"); if(fp!=NULL){ if(contenuto>0) { k--; fprintf(fp,"%d,%d",k/m,k%m); } else fprintf(fp,"%d,%d",-1,-1); fclose(fp); } } int verifica(int mat[100][100] , int v[], int n, int m, int nv, int i1,int j1){ int cont=0,i; if ((n*m-(n-1-i1)*m+m-j1)>=nv) { i=0; while(v[i]==mat[i1+(j1+i)/m][(j1+i)%m] && i