3 solutions
-
1
#include<bits/stdc++.h> using namespace std; int main(){ char f[105][105],tmp; int m,n; float wheat=0.0,grape=0.0,watermelon=0.0; cin>>m>>n; for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ cin>>f[i][j]; } } for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ cin>>tmp; float t; if(tmp=='N')t=1.0; else if(tmp=='B')t=1.2; else if(tmp=='R')t=1.5; else if(tmp=='G')t=2; if(f[i][j]=='*')wheat+=t; else if(f[i][j]=='#')grape+=t; else if(f[i][j]=='@')watermelon+=t; } } printf("%.1f %.1f %.1f",wheat,grape,watermelon); return 0; }
Information
- ID
- 1087
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 8
- Tags
- (None)
- # Submissions
- 87
- Accepted
- 13
- Uploaded By