Official

A - Blood Pressure Editorial by en_translator


Execute the addition, subtraction, and division just as the problem statement instructs.
One thing you have to note is that in some programming language the result of a division of an integer-typed (e.g. int type in C++) value by another is truncated.
The following are the examples of accepted and unaccepted code in C++.

Sample Code in C++ (AC):

#include<bits/stdc++.h>
using namespace std;

signed main(){
    int a,b;
    cin>>a>>b;
    double c=(a-b)/3.0+b;
    cout<<c<<endl;
    return 0;
}

Sample Code in C++ (AC):

#include<bits/stdc++.h>
using namespace std;

signed main(){
    int a,b;
    cin>>a>>b;
    double c=(double)(a-b)/3+b;
    cout<<c<<endl;
    return 0;
}

Sample Code in C++ (WA):

#include<bits/stdc++.h>
using namespace std;

signed main(){
    int a,b;
    cin>>a>>b;
    double c=(a-b)/3+b;
    cout<<c<<endl;
    return 0;
}

posted:
last update: