5 solutions

  • 2
    @ 2024-8-23 15:10:49
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int a,b,c;
    	cin>>a>>b>>c;
    	if(a>b) //保证 a<=b 
    	{
    		int t=a;
    		a=b;
    		b=t;
    	} 
    	if(a>c) //保证a<=c 
    	{
    		int t=a;
    		a=c;
    		c=t;
    	}
    	if(b>c) //保证b<=c 
    	{
    		int t=b;
    		b=c;
    		c=t;
    	}
    	if(a+1==b&&b+1==c)
    	{
    		cout<<"TRUE";
    	}
    	else
    	{
    		cout<<"FALSE";
    	}
    	return 0;
    }
    
    • 0
      @ 2025-8-19 16:03:12
      #include<bits/stdc++.h>
      using namespace std;
      int main(){
      	int n[3];
      	for(int i=0;i<3;i++){
      		cin>>n[i];
      	}
      	sort(n,n+3);
      	if(n[0]+1==n[1] and n[0]+2==n[2]){
      		cout<<"TRUE";
      	}
      	else{
      		cout<<"FALSE";
      	}
      	return 0;
      }
      
      
      
      • @ 2025-8-19 16:03:47

        清晰的思路,优秀的方法

    • 0
      @ 2024-12-17 20:32:26
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      int a,b,c;
      cin>>a>>b>>c;
      if(a>b)
      {
      	int t=a;
      	a=b;
      	b=t;
      }
      if(a>c)
      {
      	int t=a;
      	a=c;
      	c=t;
      }
      if(b>c)
      {
      	int t=b;
      	b=c;
      	c=t;
      }
      if(a+1==b&&b+1==c)
      {
      	cout<<"TRUE";
      }
      else
      {
      	cout<<"FALSE";
      }
      return 0;
      }
      
      • 0
        @ 2024-7-18 18:57:18
        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
            int a,b,c,temp;
            cin>>a>>b>>c;
            //排序
            if(a>b)
            {
                temp=a;
                a=b;
                b=temp;
            }
            if(b>c)
            {
                temp=b;
                b=c;
                c=temp;
            }
            if(a>b)
            {
                temp=a;
                a=b;
                b=temp;
            }
            if(c-1==b && b-1==a) cout<<"TRUE";
            else cout<<"FALSE";
            return 0;
        }
        
        • -1
          @ 2025-7-2 11:26:40
          #include<bits/stdc++.h>
          using namespace std;
          int main()
          {
            int a[5];
            for(int i=1;i<=3;i++) cin>>a[i];
            sort(a+1,a+3);
            if(a+1==b&&b+1==c) cout<<"TRUE";
            else cout<<"FALSE";
          }
          
          • 1

          Information

          ID
          35
          Time
          1000ms
          Memory
          256MiB
          Difficulty
          1
          Tags
          # Submissions
          309
          Accepted
          82
          Uploaded By