Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <iterator>
  4. using namespace std;
  5. int main()
  6. {
  7. vector <int> v,c;
  8. vector <int> ::iterator it;
  9. int n,i,j,total=0,kuna1=0,colum=0,kuna2=0;
  10. cin>>n;
  11. int a[n][n];
  12. for(i=0;i<n;i++)
  13. {
  14. int sum=0;
  15. for(j=0;j<n;j++)
  16. {
  17. char m;
  18. cin>>m;
  19. if(m>='A'&&m<='Z')
  20. {
  21. int x=int(m)-64;
  22. a[i][j]=x;
  23. }
  24. else
  25. {
  26. int x=95-int(m);
  27. a[i][j]=~x;
  28.  
  29. }
  30. if(i==j)
  31. {
  32. kuna1=kuna1+a[i][j];
  33. }
  34.  
  35.  
  36.  
  37.  
  38.  
  39. sum=sum+a[i][j];
  40. total=total+a[i][j];
  41. }
  42. v.push_back(sum);
  43.  
  44.  
  45. }
  46.  
  47.  
  48.  
  49.  
  50.  
  51. for(it=v.begin();it!=v.end();it++)
  52. {
  53. cout<<*it<<endl;
  54. }
  55. for(j=0;j<n;j++)
  56. {
  57. colum=0;
  58. for(i=0;i<n;i++)
  59. {
  60. colum=colum+a[i][j];
  61. }
  62. cout<<colum<<endl;
  63.  
  64. }
  65.  
  66.  
  67.  
  68. cout<<kuna1<<endl;
  69. j=0;
  70. for(i=n-1;i>=0;i--)
  71. {
  72.  
  73. kuna2=kuna2+a[i][j];
  74. j++;
  75.  
  76.  
  77. }
  78.  
  79. cout<<kuna2<<endl;
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102. cout<<total<<endl;
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112. return 0;
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement