判断闰年
//I LOVE 闰年
#include<iostream>
using namespace std;
int main(){
int x;
cin>>x;
if((x%4==0&&x%100!=0)||(x%400==0)){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
return 0;
}
tips
判断闰年的方法:被4整除但不被100整除,或者被400整除
员工薪水
//员工薪水
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
int x;
float salary;
cin>>x;
if(x<=10000){
salary=1500+x*0.05;
cout<<fixed<<setprecision(2)<<salary<<endl;
}else if(x>10000&&x<=50000){
salary=1500+10000*0.05+(x-10000)*0.03;
cout<<fixed<<setprecision(2)<<salary<<endl;
}else if(x>50000){
salary=1500+10000*0.05+40000*0.03+(x-50000)*0.02;
cout<<fixed<<setprecision(2)<<salary<<endl;
}
return 0;
}
注意中间段也要算上
网友评论