2 solutions

  • 2
    @ 2025-7-10 11:23:40
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int a,b;
    	cin>>a>>b;
    	for(int i=10;i<=99;i++){
    		int g=i%10;
    		int s=i/10%10;
    		if(s+g==a&&(s-g==b||g-s==b)){
    			cout<<i;
    			break;
    		}
    	}
    	return 0;
    }
    
    
    
    • 0
      @ 2026-8-11 13:59:32

      帮忙点个赞,求求了

      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int a,b;
      	cin>>a>>b;
      	for(int i=10;i<=99;i++)
      	{
      		int shi=i/10;
      		int ge=i%10;
      		if(shi+ge==a&&abs(shi-ge)==b)
      		{
      			cout<<i;
      			return 0;
      		}
      	}
      	return 0; 
      }
      
      • 1

      Information

      ID
      2844
      Time
      1000ms
      Memory
      64MiB
      Difficulty
      1
      Tags
      # Submissions
      124
      Accepted
      42
      Uploaded By