5 solutions

  • 1
    @ 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-3-29 11:06:48
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	int a,b,c;
      	cin>>a>>b>>c;
      	if(a+1==b&&a+2==c)
      	{
      		cout<<"TRUE";
      	}
      	else if(b-1==a||b-1==c&&b-2==a||b-2==b)
      	{
      		cout<<"TRUE";
      	}
      	else if(a-1==b&&a-2==c)
      	{
      		cout<<"TRUE";
      	}
      	else
      	{
      		cout<<"FALSE";
      	}
      	return 0;
      }
      
      • 0
        @ 2025-3-29 11:05:58

        #include<bits/stdc++.h> using namespace std; int main() { int a,b,c; cin>>a>>b>>c; if(a+1b&&a+2c) { cout<<"TRUE"; } else if(b-1a||b-1c&&b-2a||b-2b) { cout<<"TRUE"; } else if(a-1b&&a-2c) { cout<<"TRUE"; } else { cout<<"FALSE"; } return 0; }

        • 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

            Information

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