5 条题解

  • 3
    @ 2024-5-12 9:25:13

    #include<bits/stdc++.h>

    using namespace std;

    int main(){

    int x,y,z,q;

    cin>>x>>y>>z>>q;

    if(2x+5y+3*z<=q){

    cout<<"Yes"<<endl;

    cout<<q-(2x+5y+3*z);

    }else if(2x+5y+3*z>q){

    cout<<"No"<<endl;

    cout<<(q-(2x+5y+3z))-1;

    }

    return 0;

    }

    • 1
      @ 2024-5-12 11:30:04
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {   int a,z,s,x,d;
          cin>>a>>s>>z>>x;
          d=a*2+s*5+z*3;
          if(d<=x){
          	cout<<"Yes"<<endl<<x-d;
      	}
      	else{
      	    cout<<"No"<<endl<<d-x;	
      	}
      	return 0;
      }
      
      
      • 1
        @ 2024-5-12 9:27:37
        #include <bits/stdc++.h>
        using namespace std;
        int main(){
            int x,y,z,q,a,o;
            cin>>x>>y>>z>>q;
            a=q-x*2-y*5-z*3;
            if (a>=0) {
            cout<<"Yes"<<endl;
            cout<<a;
            }else {
            o=a-a*2;
            cout<<"No"<<endl;
            cout<<o;
            }
            return 0;
        }
        
        • 0
          @ 2024-5-12 9:24:37

          #include<bits/stdc++.h> using namespace std; int main(){ int x,y,z,q,p,x1=2,y1=5,z1=3,a,b,c,d,e,f; cin>>x>>y>>z>>q; a=xx1; b=yy1; c=z*z1; d=a+b+c; e=d-q; f=q-d; if(q<d){ cout<<"No"<<endl; cout<<e; }else{ cout<<"Yes"<<endl; cout<<f; } return 0; }

          • -1
            @ 2024-3-21 18:00:12
            #include<bits/stdc++.h>
            using namespace std;
            int main()
            {   int a,z,s,x,d;
                cin>>a>>s>>z>>x;
                d=a*2+s*5+z*3;
                if(d<=x){
                	cout<<"Yes"<<endl<<x-d;
            	}
            	else{
            	    cout<<"No"<<endl<<d-x;	
            	}
            	return 0;
            }
            
            • 1

            信息

            ID
            2171
            时间
            1000ms
            内存
            256MiB
            难度
            1
            标签
            递交数
            184
            已通过
            92
            上传者