其他语言

本类阅读TOP10

·基于Solaris 开发环境的整体构思
·使用AutoMake轻松生成Makefile
·BCB数据库图像保存技术
·GNU中的Makefile
·射频芯片nRF401天线设计的分析
·iframe 的自适应高度
·BCB之Socket通信
·软件企业如何实施CMM
·入门系列--OpenGL最简单的入门
·WIN95中日志钩子(JournalRecord Hook)的使用

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
一道初学者题目,“ 用1-9数字做不重复填充等式:_ _ _ _X_=_ _ _ _”

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

// 乾坤一笑[smileonce]    [email protected]   2004-7-23
// 版权所有 转载请注明出处  http://blog.csdn.net/smileonce
// math_t.cpp : Defines the entry point for the console application.
// 我来示范一下效率、正确性和易维护性的结合。 // 谁在丢砖头?我不是玻璃干吗砸我,我跑~~~ #include "stdafx.h" #include #include using namespace std; int _tmain(int argc, _TCHAR* argv[]) { set<int> num_set; for (int i=2; i<=9; i++) { int max_try = 9876 / i ; for (int j=1234; j<max_try; j++) { int k = i*j; if (k>10000) continue; num_set.clear(); num_set.insert(0); num_set.insert(i); num_set.insert(j/1000); num_set.insert(j/100%10); num_set.insert(j/10%10); num_set.insert(j%10); num_set.insert(k/1000); num_set.insert(k/100%10); num_set.insert(k/10%10); num_set.insert(k%10); if (num_set.size()==10) cout << j << " * " << i << " = " << k << endl; } } return 0; }



相关文章

相关软件