3 solutions

  • 1
    @ 2026-1-6 13:31:21

    #include <bits/stdc++.h> using namespace std;

    int main() { int a, b, c, d; cin >> a >> b >> c >> d; cout << a - (b + c - d); return 0; }

    • 1
      @ 2025-10-29 9:26:51
      #include<iostream>
      using namespace std;
      int main(){
          int n, a, b, c;
          cin>>n>>a>>b>>c;
          if(n<=10000&&n>0){
              if(a>0&&a<=n&&
                 b>0&&b<=n&&
                 c>0&&c<=n){
                  if(c<min(a,b)){
                      int d = n-a-b+c;
                      cout<<d<<endl;
                      return 0 ;
                  }else{
                      cout<<"输入的数据格式不正确"<<endl;
                      return 1;//程序异常退出
                  }
              }else{
                      cout<<"输入的数据格式不正确"<<endl;
                      return 1;//程序异常退出
                  }
          }else{
                      cout<<"输入的数据格式不正确"<<endl;
                      return 1;//程序异常退出
                  }
      }
      
      • 0
        @ 2026-2-5 15:31:47

        #include <bits/stdc++.h> using namespace std;

        int main() { int n, a, b, c; cin >> n >> a >> b >> c; cout << n - (a - c) - (b - c) - c; return 0; }

        • 1

        Information

        ID
        282
        Time
        1000ms
        Memory
        256MiB
        Difficulty
        3
        Tags
        # Submissions
        474
        Accepted
        245
        Uploaded By