> 2009/05/27 (水) 22:49:17 ◆ ▼ ◇ [qwerty]> >
> > #include "stdafx.h"
> > #include <stdlib.h>
> > #include <string>
> > __int64 table[]={1,5,3,2,8,4,9,0,1,2,3,4,1,5,3,2,8,4,9,0,1,2,3,4};
> > int ntable = sizeof(table)/sizeof(__int64);
> >
> > __int64 func( std::string &str, __int64 total, __int64 *tbl, int ntbl)
> > {
> > for(int i=0;i<ntbl; ++i){
> > std::string s = str+",";
> > char buf[0x40];
> > _ltoa_s((long)tbl[i],buf,0x40,10);
> > s += buf;
> > if( total+tbl[i]==9){
> > printf("みつけたよ(%s)\n", s.c_str());
> > } else {
> > func( s, total+tbl[i], &tbl[i+1], (ntbl-(i+1) ) );
> > }
> > }
> > return total;
> > }
> > int _tmain(int argc, _TCHAR* argv[])
> > {
> > std::string str;
> > func(str, 0, table, ntable);
> > return 0;
> > }
> > とりあえずでかい数字を扱えるようにはしてみたが500個程度でも結構気が遠くなる時間がかかりそうな気がするな(;´Д`)
> ありがとうございます(;´Д`)これで宿題が終わりました
いいなあ住人同士で問題を解決しあえて(;´Д`)
今日課長から来た
「本社から他支店の落ち込み分を東京支店に回すことになったので月曜までに自分の担当県の
販促方法を考えてきてくれ」問題も解決してくれよう
参考:2009/05/27(水)22時46分40秒