1 solutions
-
0
C :
#include<stdio.h> main() { char sex; float faHeight,moHeight; char sport; char diet; float height = 0; scanf(" %c",&sex); scanf("%f %f",&faHeight,&moHeight); scanf(" %c",&sport); scanf(" %c",&diet); if(sex == 'M') { height = (faHeight + moHeight) * 0.54; if(sport == 'Y') height = height*1.02; if(diet == 'Y') height = height*1.015; } else { height = (faHeight + moHeight)/2; if(sport == 'Y') height = height*1.02; if(diet == 'Y') height = height*1.015; } printf("%0.2f",height); return 0; }C++ :
#include<bits/stdc++.h> using namespace std; char a,b,c; double sg; double fh,mh; int main() { cin>>a; cin>>fh>>mh; cin>>b>>c; if(a=='F'||a=='f') sg=(fh+mh)/2; if(a=='M'||a=='m') sg=(fh+mh)*0.54; if(b=='y'||b=='Y') sg+=sg/100*2; if(c=='y'||c=='Y') sg+=sg/100*1.5; printf("%.2f",sg); return 0; }
- 1
Information
- ID
- 17208
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By