AcWing 669. 加薪
原题链接
简单
#include<iostream>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<iomanip>
using namespace std;
int main(){
double salary;
double new_sal;
double amount;
double per;
cin >> salary;
if(salary <= 400){
new_sal = 1.15 * salary;
}else if(salary <= 800){
new_sal = 1.12 * salary;
}else if(salary <= 1200){
new_sal = 1.1 * salary;
}else if(salary <= 2000){
new_sal = 1.07 * salary;
}else{
new_sal = 1.04 * salary;
}
amount = new_sal - salary;
per = (new_sal - salary) / salary * 100;
cout << "Novo salario: " << fixed << setprecision(2) << new_sal <<endl;
cout << "Reajuste ganho: " << fixed << setprecision(2) << amount <<endl;
cout << "Em percentual: " << fixed << setprecision(0) << per << " %" <<endl;
return 0;
}