第9周项目6(5)-解奥数题

来源:互联网 发布:七雄战记网络错误1 编辑:程序博客网 时间:2024/05/16 14:51
/* *Copyright (c) 2014, 烟台大学计算机学院 *All rights reserved. *文件名称:week9-project6-5.cpp *作者:高赞 *完成日期:2014年 10 月 27 日 *版本号:v1.0 * *问题描述:C+学C+要学C+都要学C=2008,求分别代表的数字 *输入描述:无 *程序输出:整数,表示 都,要,学,C 分别代表的数字 */#include <iostream>using namespace std;int main(){    int a,b,c,d;    for (a=1; a<=9; a++)        for (b=1; b<=9; b++)            for (c=1; c<=9; c++)                for (d=1; d<=9; d++)                {                    if (1000*a+200*b+30*c+4*d==2008)                        cout << "都=" << a << ",要=" << b << ",学=" << c                             << ",C=" << d << "," << endl;                }    return 0;}


 

运算结果:

0 0