include math include stdio main int 100 100 1000 printf stolbzi scanf

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include<math.h>
#include<stdio.h>
main(){
int n,m,a[100][100],i,j,b[1000],k=0;
printf("stolbzi:");
scanf("%d",&n);
printf("stroki:");
scanf("%d",&m);
FILE*in;
FILE*ou;
in=fopen("input.txt","r");
ou=fopen("output.txt","w");
for(i=1;i<=m;i++){
b[i]=0;
}
for(i=1;i<=m;i++){
for(j=1;j<=n;j++){
fscanf(in,"%d",&a[i][j]);
if(a[i][j]!=0) b[i]++;
}
}
i=0;
while (k<2){
i++;
if(i==m){
printf("HET ODUHAKOBbIX CTPOK!!!");
fprintf(ou,"HET ODUHAKOBbIX CTPOK!!!");
return(0);
}
if(b[i]!=0){
k=1;
for(j=i+1;j<=m;j++){
if(b[i]==b[j]) k++;
}
}
}
for(j=1;j<=n;j++){
b[j]=a[i][j];
}
for(i=1;i<=m;i++){
for(j=1;j<=n;j++){
a[i][j]=a[i][j]-b[j];
}
}
for(i=1;i<=m;i++){
for(j=1;j<=n;j++){
fprintf(ou,"%d ",a[i][j]);
}
fprintf(ou,"\n");
}
}