修练者
整形 a;
ch-a-r g;
超长 a1,a2,a3,a4,ltgb,oqls,byhl,sbs;
开始(){
输入>>a>>g;
字符串 b="SF",c="YD",d="Same";
如果(g为'n'){
如果(a<=1000){
输出<<c;
return 0;
}else if(a>1000){
a为a-1000;
a1为a/500;
if(a mod 500!=0){
a1++;
}
ltgb=12+a1*3;
oqls=8+a1*4;
if(ltgb>oqls){
输出<<c;
return 0;
}else if(oqls>ltgb){
输出<<b;
}else if(ltgb为oqls){
输出<<d;
return 0;
}
}
}else if(g=='y'){
if(a<=1000){
cout<<d;
return 0;
}else if(a>1000){
a=a-1000;
a1=a/500;
if(a%500!=0){
a1++;
}
ltgb=12+a1*3;
oqls=8+a1*4+4;
if(ltgb>oqls){
cout<<c;
return 0;
}else if(oqls>ltgb){
cout<<b;
}else if(ltgb==oqls){
cout<<d;
return 0;
}
}
AC 100 求采纳~~~
资深天翼
核心代码如下:
if(a<=1000){
x=12;
}else{
x=12+(a-1000)/500*3;
if((a-1000)%500!=0){
x=x+3;
}
}
if(a<=1000){
y=8;
}else{
y=8+(a-1000)/500*4;
if((a-1000)%500!=0){
y=y+4;
}
}
if(jj=='y'){
y=y+4;
}
if(x>y){
cout<<"YD";
}
if(x<y){
cout<<"SF";
}
if(x==y){
cout<<"Same";
}