1.给定n,输出满足abc+acc=n时的abc和acc,1<=a<=9,0<=b<9,0<=c<=9。

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 
 4 int main()
 5 {
 6     int n;
 7     int countt=0;
 8     vector<int> res1,res2;
 9     cin>>n;
10     for(int a=1;a<=9;a++){
11         for(int b=0;b<=9;b++){
12             for(int c=0;c<=9;c++){
13                 if(a!=b&&b!=c){
14                     if((a*100+b*10+c+a*100+c*10+c)==n){
15                         countt++;
16                         res1.push_back(a*100+b*10+c);
17                         res2.push_back(a*100+c*10+c);
18                     }
19                 }
20             }
21         }
22     }
23     cout<<countt<<endl;
24     for(int i=0;i<res1.size();i++){
25         cout<<res1[i]<<" "<<res2[i]<<endl;
26     }
27     return 0;
28 }
View Code

相关文章:

  • 2021-08-17
  • 2021-11-01
  • 2021-11-04
  • 2022-12-23
  • 2021-06-19
  • 2021-09-03
  • 2021-11-02
  • 2022-12-23
猜你喜欢
  • 2021-10-10
  • 2021-05-17
  • 2021-05-27
  • 2022-12-23
  • 2021-11-03
  • 2021-10-10
  • 2022-12-23
相关资源
相似解决方案