3 条题解

  • 3
    @ 2026-6-11 22:19:32
    #include<bits/stdc++.h> 
    using namespace std;
    int main() {
    long long a,b,c,a1,b1,c1;
    cin>>a>>b>>c;
    a1=max(a,max(c,b));
    b1=min(a,min(b,c));
    c1=a+b+c-a1-b1;
    if(c1+1==a1&&c1-1==b1){
    cout<<"TRUE";
    }
    else{
    cout<<"FALSE";
    }
            return 0;
        }
             
    
    
    • 0
      @ 2026-6-6 11:27:29

      #include #include using namespace std;

      int main() { int a, b, c; cin >> a >> b >> c; int arr[3] = {a, b, c}; sort(arr, arr + 3);

      // 排序后:arr[0],arr[1],arr[2]
      // 条件1:最大-最小==2;条件2:三个数互不相等
      if(arr[2]-arr[0]==2 && arr[0]!=arr[1] && arr[1]!=arr[2])
      {
          cout << "TRUE";
      }
      else
      {
          cout << "FALSE";
      }
      return 0;
      

      }

      • -1
        @ 2026-5-31 17:35:30

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

        //main int main() { int a, b, c; cin >> a >> b >> c; if (a == b - 1 || c == b + 1) { cout << "TRUE" << endl; } else { cout << "FALSE" << endl; }

        return 0;
        

        } 为什么这个只得80分?

        • @ 2026-6-11 22:19:57
          #include<bits/stdc++.h> 
          using namespace std;
          int main() {
          long long a,b,c,a1,b1,c1;
          cin>>a>>b>>c;
          a1=max(a,max(c,b));
          b1=min(a,min(b,c));
          c1=a+b+c-a1-b1;
          if(c1+1==a1&&c1-1==b1){
          cout<<"TRUE";
          }
          else{
          cout<<"FALSE";
          }
                  return 0;
              }
                   
          
          
      • 1

      【入门】判断三个整数是否相邻

      信息

      ID
      30046
      时间
      1000ms
      内存
      256MiB
      难度
      5
      标签
      递交数
      81
      已通过
      29
      上传者