uri 1182 - uri 1182 solution || URI problem 1182 solution in C | (Column in Array) - Code , ||
2060 - Problem - solve - Code: uri , Solution of URI 1182 :: Column in Array ~try Yourself first ,
2060 - Problem - solve - Code: uri , Solution of URI 1182 :: Column in Array ~try Yourself first ,
1182 - Column in Array - URI Online Judge
/*** Solve :: Try yourself first ***/
URI-1182-solve |
Problem Details: Click to see full problem...
Solution in C++:
#include <iostream>
#include<iomanip>
using namespace std;
int main()
{
int C,x,y;char T[2];double aa=0.0, M[12][12];
cin>>C;
cin>>T;
for(int x=0;x<12;x++){
for(int y=0;y<12;y++){
// double num;
scanf("%lf",&M[x][y]);
if(y==C){
aa = aa+ M[x][y];
}
}
}
if(T[0] == 'S') cout<<fixed<<setprecision(1)<<aa<<endl;
else if(T[0] == 'M'){ cout<<fixed<<setprecision(1)<<aa/12.0<<endl;}
return 0;
}
#include<iomanip>
using namespace std;
int main()
{
int C,x,y;char T[2];double aa=0.0, M[12][12];
cin>>C;
cin>>T;
for(int x=0;x<12;x++){
for(int y=0;y<12;y++){
// double num;
scanf("%lf",&M[x][y]);
if(y==C){
aa = aa+ M[x][y];
}
}
}
if(T[0] == 'S') cout<<fixed<<setprecision(1)<<aa<<endl;
else if(T[0] == 'M'){ cout<<fixed<<setprecision(1)<<aa/12.0<<endl;}
return 0;
}
nice
ReplyDelete