#26 翻转数的和#
#include<stdio.h>
int main()
{
int a,b;
int solve(int a);
while(~scanf("%d %d",&a,&b))
{
int c=solve(a);
int d=solve(b);
printf("%d\n",c+d);
}
return 0;
}
int solve(int a)
{
int t=0;
while(a>0)
{
t=t*10+a%10;
a=a/10;
}
return t;
}
#33 三个数的最大值#
#include<stdio.h>
int main()
{
int a,b,c;
int solve(int a,int b,int c);
while(~scanf("%d %d %d",&a,&b,&c)){
printf("%d\n",solve(a,b,c));
return 0;
}
}
int solve(int a,int b,int c)
{
int max;
if(a>b){
if(a>c){
max=a;
}else{
max=c;
}
}
if(a<b){
if(b<c){
max=c;
}else{
max=b;
}
}
return max;
}
#34 计算函数#
#include<stdio.h>
int main()
{
int x;
int solve(int x);
while(~scanf("%d",&x)){
printf("%d\n",solve(x));
}
return 0;
}
int solve(int x)
{
int y;
if(x<1){
y=x;
}
if(x>=1&&x<10){
y=2*x-1;
}
if(x>=10){
y=3*x-11;
}
return y;
}
#35 成绩的等级#
#include<stdio.h>
int main()
{
int score;
char solve(int score);
while(~scanf("%d",&score)){
printf("%c\n",solve(score));
}
return 0;
}
char solve(int score)
{
char grade;
if(score>=90){
grade='A';
}
if(score>=80&&score<89){
grade='B';
}
if(score>=70&&score<79){
grade='C';
}
if(score>=60&&score<69){
grade='D';
}
if(score<60){
grade='E';
}
return grade;
}
#37 利润提成#
#include<stdio.h>
int main()
{
double I;
double solve(double I);
while(~scanf("%lf",&I)){
printf("%g\n",solve(I));
}
return 0;
}
double solve(double I){
double J;
if(I<=100000)
J=I*0.1;
else if(I<=200000)
J=100000*0.1+(I-100000)*0.075;
else if(I<=400000)
J=100000*0.1+(200000-100000)*0.075+(I-200000)*0.05;
else if(I<=600000)
J=100000*0.1+(200000-100000)*0.075+(400000-200000)*0.05+(I-400000)*0.03;
else if(I<=1000000)
J=100000*0.1+(200000-100000)*0.075+(400000-200000)*0.05+(600000-40