上一页 1 2 3 4 5 6 ··· 8 下一页
摘要: /*PROB:dualpalLANG:C++*/#include#include#include#include#includeusing namespace std;stack rem_stack; string transtoN(int num_ten,int base){ stringstream ss; string str_n=""; int irem=0; char crem=' '; if(base==10){ ss>n>>s; for(int i=s+1;i<65536;i++){ count_base=0; ... 阅读全文
posted @ 2013-08-02 16:44 开心成长 阅读(190) 评论(0) 推荐(0) 编辑
摘要: /*PROB:palsquareLANG:C++*/#include#include#include#include#include#includeusing namespace std;const int code[]={10,11,12,13,14,15,16,17,18,19}; stack rem_stack; //十进制转换成n进制string transtoN(int num_ten,int base){ string str_n=""; int irem=0; char crem=' '; while(num_ten!=0){ i... 阅读全文
posted @ 2013-07-31 20:55 开心成长 阅读(190) 评论(0) 推荐(0) 编辑
摘要: stack pro_stack;string multi_single(string mplier,char mplicand,int base){ int len=mplier.size(); int mplicand_ten=0; if(mplicand-48=0;i--){ if(mplier[i]-489) cpro=product-10+'A'; else cpro=(char)(product+48); pro_stack.push(cpro); carry=re... 阅读全文
posted @ 2013-07-29 17:53 开心成长 阅读(861) 评论(0) 推荐(0) 编辑
摘要: int ia;char ca;ca=(char)(ia+48);ia=(int)(ca-48); 阅读全文
posted @ 2013-07-29 16:21 开心成长 阅读(570) 评论(0) 推荐(0) 编辑
摘要: 这道题,我本打算逐位将数字转化成一个三个字符的字符串,对于第一个数字,进行二分查找,查找到相应三个字符的起始位置。在这3段中,查找第二个数字对应的三个字符的位置,就有9段。再查找到第三个数字对应的三个字符的位置,就有27段了。现在对这27段中的每个字符串,先比较其长度是否符合,再逐位比较剩余字符(除前面3个字符)是否符合。。大致思路就是先用二分查找缩小范围,再进行比较。。感觉不好!这段是别人的代码。主要思路是:读出dict.txt中的所有字符串,转化成数字串表示,再将每一个数字串与输入的数字串进行比较,就把多对多的比较,转化成了多对一的比较。思路、实现,都最简单的方式。代码的实现其实很好,读入 阅读全文
posted @ 2013-07-28 19:59 开心成长 阅读(319) 评论(0) 推荐(0) 编辑
摘要: #include#include#includeusing namespace std;int main(){ ifstream ifs("dict.txt"); string *dict[5000]; int i=0; while(i#include#includeusing namespace std;int main(){ ifstream ifs("dict.txt"); char *dict[15]; int i=0; while(i>dict[i]; i++; } ifs.out; return 0;} 阅读全文
posted @ 2013-07-24 08:56 开心成长 阅读(407) 评论(0) 推荐(0) 编辑
摘要: 问题描述:已知各个长度的钢条对应的价格;长度为1、2、3、4、5、6、7、8、9、10,对应的价格分别为1、5、8、9、10、17、17、20、24、30;现有一段钢条的长度为n(0using namespace std;int cut_rod(int (&p)[11],int n){ if(n==0) return 0; int q=-99999; for(int i=1;ip[i]+p_rest?q:p[i]+p_rest); } return q;}int main(){ int p[11]={0,1,5,8,9,10,17,17,20,... 阅读全文
posted @ 2013-07-22 15:09 开心成长 阅读(562) 评论(0) 推荐(0) 编辑
摘要: #include#includeusing namespace std;int main(){ ifstream fin("transform.in"); ofstream fout("transform.out"); char bimage[10][10]; char aimage[10][10];bool tryed[8]={false,false,false,false,false,false,false,false}; int n; int i; bool is_out=false; fin>>n; for(i=0;i>bima 阅读全文
posted @ 2013-07-22 09:14 开心成长 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 1、milk.exe 中的 0x012b1f07 处有未经处理的异常: 0xC00000FD: Stack overflow解决:定义了int a[1000000]={0},在其后设置断点后,会出现上述错误,自动打开chkstk.asm文件;如果直接运行,会出现“Windows 正在关闭资源管理解决方案”。改为long a[1000000]={0} 阅读全文
posted @ 2013-07-21 11:34 开心成长 阅读(206) 评论(0) 推荐(0) 编辑
摘要: /*PROB:milk2LANG:C++*/#include#include#include#includeusing namespace std;int main(){ ifstream fin("milk2.in"); ofstream fout("milk2.out"); int n; int start_t; int end_t; int t; fin>>n; int i=0; int count=0; int max_yes; int max_no; fin>>start_t; while(i>end_t;... 阅读全文
posted @ 2013-07-20 15:53 开心成长 阅读(177) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 8 下一页