4 条题解

  • 3
    @ 2022-12-29 19:53:09
    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n, a, b, c;
    	cin >> n >> a >> b >> c;
    	if (n >= a + b + c)
            cout << n - (a + b + c) << " " << "YES";
    	else
            cout << abs(n - (a + b + c)) << " " << "NO";
    	return 0;
    }//代码已AC
    
    • 2
      @ 2023-10-23 19:12:08

      我代码最短

      #include <iostream>
      #include <cmath>
      using namespace std;
      int main()
      {
          int n, a, b, c;
          cin >> n >> a >> b >> c;
          int ans = (a + b + c);
          cout << abs(n - ans);
          cout << ((n >= ans) ? " YES" : " NO");
          return 0;
      }
      
      • 1
        @ 2023-5-3 13:52:59
        #include <iostream>
        using namespace std;
        int main()
        {
            int n,a,b,c;
            cin >> n >>a >> b >> c;
            if(n>=a+b+c)
            {
                cout << n-(a+b+c) << " " << "YES";
            }
            else
            {
                cout << (a+b+c)-n << " " << "NO";
            }
        }
        
        • 0
          @ 2023-4-5 17:17:56

          (感觉跟P361差不多)

          #include<bits/stdc++.h>
          using namespace std;
          int main()
          {
              int n,x,y,z;
              cin>>n>>x>>y>>z;
              if (n>=x+y+z)
                  cout<<n-x-y-z<<" YES";
              else
                  cout<<x+y+z-n<<" NO";
              return 0;
          }
          • 1

          信息

          ID
          632
          时间
          1000ms
          内存
          16MiB
          难度
          5
          标签
          递交数
          292
          已通过
          121
          上传者