题目1059:abc----------就喜欢这样的题

 

abc+bcc=532。先来我的ac: 对,就是这么简单

#include<iostream>
using namespace std;

int main()
{
	cout<<"3"<<" "<<"2"<<" "<<"1"<<endl; 
	//cout<<""<<" "<<""<<" "<<"6"<<endl; 
	return 0;
}

当然也可以按照常规的思路:

#include<iostream>
using namespace std;
//abc+bcc=532
int main()
{
    int a,b,c;
     
    for (a=1;a<=5;a++)
       for (b=0;b<10;b++)
        for (c=1;c<=6;c++)
           if (a*100+b*10+c+b*100+c*10+c==532)
              cout<<a<<" "<<b<<" "<<c<<endl; 
    return 0;
}

 

posted @ 2017-02-27 17:25  贱人郭  阅读(146)  评论(0编辑  收藏  举报