3 solutions

  • 1
    @ 2025-8-20 19:26:18
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	int a,b;cin>>a>>b;
    	if(a==1 and b==10 or a==10 and b==1) cout<<"Yes";
    	else{
    		if (abs(a-b)==1) cout<<"Yes";
    		else cout<<"No";
    	}
    	return 0;
    }
    
    
    
    • 0
      @ 2025-11-2 14:51:49
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	int a,b;
      	cin>>a>>b;
      	if(a+1==b||a==1&&b==10)
      	{
      		cout<<"Yes";
      	}
      	else
      	{
      		cout<<"No";
      	}
      	return 0;
      }
      
      
      • 0
        @ 2025-8-18 16:14:46
        #include<bits/stdc++.h>
        using namespace std;
        int a,b;
        int main(){
        	cin>>a>>b;
        	if(abs(a-b)==1){
        		cout<<"Yes";
        	}else if(a==1&&b==10||a==10&&b==1){
        		cout<<"Yes";
        	}else{
        		cout<<"No";
        	}
        	
        	
        	return 0;
        } 
        
        • 1

        Information

        ID
        2326
        Time
        1000ms
        Memory
        256MiB
        Difficulty
        1
        Tags
        (None)
        # Submissions
        113
        Accepted
        39
        Uploaded By