问题标题: 1880

0
0

0
已采纳
方宇哲
方宇哲
资深守护
资深守护
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if(n>100)
    {
        s1=15*j+5*x+1*c;
        s=n-(15*j+5*x+1*c);
        cout<<s1<<" "<<s;
    }else if(n>30&&n<=100)
    {
        s1=10*j+2*x;
        s=n-(10*j+2*x);
        cout<<s1<<" "<<s; 
    }else {
        cout<<n;
    }

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

核心代码!!!!!!

0
0
褚福磊
褚福磊
新手光能
新手光能
        if(a<=100&&a>30) 
    { 
    b=10*2+2*5;
    a-=b;
    } 
    else if(a<=30) 
    { 
    b=0;
    a=a-b;
    }
            if(a>100) 
    { 
    b=15*2+5*5+15;
    a=a-b;
    }   

    cout<<b<<" "<<a;
0
谢其桦
谢其桦
资深守护
资深守护

if(n == 0) cout<<0;

 

else if(n == 100000) cout<<"1shiwan";

 

else{

 

while(n){

 

i++;

 

a[i] = n%10;

 

n /= 10;

 

}

 

for(i = i;i >= 1;i--){

 

if(a[i] != 0){

 

if(flag == true){

 

cout<<0;

 

flag=false;

 

}

-1
张睿杰
张睿杰
初级天翼
初级天翼

詹子都你好

思路如下

一:定义一个变量 n

二:输入n

三:判断n>100 是的话输出 70和n-30-25-15

否则判断n<=100&&n>30 是的话输出 30和n-20-10

否则直接输出 0和n

我要回答