#include<stdio.h> #include<stdbool.h> #include<math.h> int main(){ int a; scanf("%d",&a); int b=a; int c; int sum=0; while(a--){ for(int x=0;x<b;x++){ scanf("%d",&c); } } for(int t=b;t>0;t--){ sum=sum+(t/2)*(2*b)+(t%2)*b; } printf("%d\n",sum); return 0; } |
Double click to view unformatted code.