NOJ/42/main.c

17 lines
362 B
C
Raw Permalink Normal View History

2020-08-31 16:46:43 +00:00
#include <stdio.h>
int main(void){
int m,n;
scanf("%d %d",&m,&n);//m is line.
int i, all = m * n, line,sum = 0,num,asum = 0;
for(i = 0; i < all; i++){
scanf("%d",&num);
asum += num;
line = i/n;
if(!line || line == m-1) sum += num;
else if(!(i - line*n) || !((i+1) - (line+1)*n)) sum += num;
}
printf("%d\n",asum - (asum - sum)*2);
return 0;
}