Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- int a[25][25];
- int main ()
- {
- int i,j,n,c1=0,c2=0;
- float s1=0,s2=0,m1,m2,rez;
- cin>>n;
- for (i=1;i<=n;i++)
- {
- for (j=1;j<=n;j++)
- {
- cin>>a[i][j];
- }
- }
- for (i=1;i<=n;i++)
- {
- for (j=1;j<=n;j++)
- {
- if (i<j)
- {
- if (a[i][j]>0)
- {
- s1=s1+a[i][j];
- c1++;
- }
- }
- else if (i>j)
- {
- if (a[i][j]>0)
- {
- s2=s2+a[i][j];
- c2++;
- }
- }
- }
- }
- m1=1.00*s1/c1;
- m2=1.00*s2/c2;
- cout<<setprecision(2)<<fixed<<floor((m1-m2)*100)/100;
- return 0;
- }
- /*
- -1 2 -4 5
- 0 6 3 1
- 2 4 2 0
- 3 -5 1 -3
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement