设a、b、c 均是0 到9 之间的数字,abc、bcc 是两个三位数,且有:abc+bcc=532。求满足条件的所有a、b、c 的值。
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include <cctype>
using namespace std;
int main(){
int a,b,c;
for(int a = 0;a < 10;a++)
for(int b = 0;b < 10;b++)
for(int c = 0;c < 10;c++){
if(a*100+b*10+c+b*100+c*10+c==532)
cout<<a<<" "<<b<<" "<<c<<endl;
}
}
#include<iostream>
using namespace std;
int main(){
int f[30][3],f_count=0;
for(int a=0;a<=9;a++){
for(int b=0;b<=9;b++){
for(int c=0;c<=9;c++){
if(a*100+b*110+c*12==532){
f[f_count][0]=a;
f[f_count][1]=b;
f[f_count++][2]=c;
}
}
}
}
for(int i=0;i<f_count;i++)
cout<<f[i][0]<<" "<<f[i][1]<<" "<<f[i][2]<<endl;
}
😎