Advertisement
Saleh127

UVA 11470

Jul 6th, 2021
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define endl "\n"
  5. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);cout.tie(0);
  10.  
  11.  
  12. ll n,m,i,j,k,l,tt=0;
  13.  
  14. while(cin>>n && n)
  15. {
  16. ll a[n+5][n+5];
  17.  
  18. for(i=0;i<n;i++)
  19. {
  20. for(j=0;j<n;j++)
  21. {
  22. cin>>a[i][j];
  23. }
  24. }
  25.  
  26. cout<<"Case "<<++tt<<":";
  27.  
  28. for(i=0;i<n/2;i++)
  29. {
  30. l=0;
  31. for(j=i;j<n-i-1;j++)
  32. {
  33. l+=a[i][j]+a[n-i-1][n-j-1]+a[n-j-1][i]+a[j][n-i-1];
  34. }
  35. cout<<" "<<l;
  36. }
  37.  
  38. if(n%2) cout<<" "<<a[n/2][n/2];
  39.  
  40. cout<<endl;
  41.  
  42. }
  43.  
  44. return 0;
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement