??xml version="1.0" encoding="utf-8" standalone="yes"?>久久国产精品毛片,国产精品久久久久秋霞鲁丝,亚洲人成久久http://m.shnenglu.com/dqchen/写出一个可以工作的E序q不?/description>zh-cnSun, 16 Nov 2025 02:54:35 GMTSun, 16 Nov 2025 02:54:35 GMT60tatehttp://m.shnenglu.com/dqchen/archive/2008/09/18/62216.htmlDainDainThu, 18 Sep 2008 11:58:00 GMThttp://m.shnenglu.com/dqchen/archive/2008/09/18/62216.htmlhttp://m.shnenglu.com/dqchen/comments/62216.htmlhttp://m.shnenglu.com/dqchen/archive/2008/09/18/62216.html#Feedback0http://m.shnenglu.com/dqchen/comments/commentRss/62216.htmlhttp://m.shnenglu.com/dqchen/services/trackbacks/62216.html


Dain 2008-09-18 19:58 发表评论
]]>
Getting the Minimum and Maximum Values for a Numeric Typehttp://m.shnenglu.com/dqchen/archive/2007/05/29/25041.htmlDainDainTue, 29 May 2007 02:38:00 GMThttp://m.shnenglu.com/dqchen/archive/2007/05/29/25041.htmlhttp://m.shnenglu.com/dqchen/comments/25041.htmlhttp://m.shnenglu.com/dqchen/archive/2007/05/29/25041.html#Feedback2http://m.shnenglu.com/dqchen/comments/commentRss/25041.htmlhttp://m.shnenglu.com/dqchen/services/trackbacks/25041.htmlGetting numeric limits

#include <iostream>
#include 
<limits>

using namespace std;

template
<typename T>
void showMinMax() {
   cout 
<< "min: " << numeric_limits<T>::min() << endl;
   cout 
<< "max: " << numeric_limits<T>::max() << endl;
   cout 
<< endl;
}


int main() {
   cout 
<< "short:" << endl;
   showMinMax
<short>();
   cout 
<< "int:" << endl;
   showMinMax
<int>();
   cout 
<< "long:" << endl;
   showMinMax
<long>();
   cout 
<< "long long:" << endl;
   showMinMax
<long long>();
   cout 
<< "float:" << endl;
   showMinMax
<float>();
   cout 
<< "double:" << endl;
   showMinMax
<double>();
   cout 
<< "long double:" << endl;
   showMinMax
<long double>();
   cout 
<< "unsigned short:" << endl;
   showMinMax
<unsigned short>();
   cout 
<< "unsigned int:" << endl;
   showMinMax
<unsigned int>();
   cout 
<< "unsigned long:" << endl;
   showMinMax
<unsigned long>();
   cout 
<< "unsigned long long:" << endl;
   showMinMax
<unsigned long long>();
}


Dain 2007-05-29 10:38 发表评论
]]>
3017http://m.shnenglu.com/dqchen/archive/2007/05/25/24808.htmlDainDainFri, 25 May 2007 02:06:00 GMThttp://m.shnenglu.com/dqchen/archive/2007/05/25/24808.htmlhttp://m.shnenglu.com/dqchen/comments/24808.htmlhttp://m.shnenglu.com/dqchen/archive/2007/05/25/24808.html#Feedback0http://m.shnenglu.com/dqchen/comments/commentRss/24808.htmlhttp://m.shnenglu.com/dqchen/services/trackbacks/24808.html#include <stdio.h>
#include 
<stdlib.h>
#include 
<vector>

using namespace std;

struct Node 
{
    
int i,j;
    
int value;
}
;

long num[100000];
vector
<Node> matrix;

int main() {
    
long n;
    
long long m;
    scanf(
"%ld %lld",&n,&m);

    
long i,j;
    
for(i = 0;i < n;++i) {
        scanf(
"%ld",&num[i]);
    }


    
for(i = 0;i < n;++i) {
        
if(num[i] > m) {
            
break;
        }

    }


    
if(i < n) {
        printf(
"-1\n");

        
return 0;
    }


    
long long res = -1;
    
long long sum;
    
long max,min = 0;
    
for(i = 0;i < n;++i) {
        
if(i > 0{
            min 
= 1000000;
            
for(j = 0;j < matrix.size();++j) {
                
if(matrix[j].j == i - 1 && matrix[j].value < min) {
                    min 
= matrix[j].value;
                }

            }

        }

        
else {
            min 
= 0;
        }


        sum 
= 0;
        Node node;
        max 
= -1;
        
for(j = i;j < n;++j) {
            sum 
+= num[j];
            
if(sum <= m) {
                
if(max < num[j]) {                    
                    max 
= num[j];
                }

                node.i 
= i;
                node.j 
= j;
                node.value 
= max + min;
                matrix.push_back(node);
                
if(j == n - 1{
                    
if(res != -1{
                        
if(node.value < res) {
                            res 
= node.value;
                        }

                    }

                    
else {
                        res 
= node.value;
                    }

                }

            }

            
else {
                
break;
            }

        }

    }

    
    printf(
"%lld\n",res);

    
return 0;
}


Dain 2007-05-25 10:06 发表评论
]]>
3017http://m.shnenglu.com/dqchen/archive/2007/05/25/24809.htmlDainDainFri, 25 May 2007 02:06:00 GMThttp://m.shnenglu.com/dqchen/archive/2007/05/25/24809.htmlhttp://m.shnenglu.com/dqchen/comments/24809.htmlhttp://m.shnenglu.com/dqchen/archive/2007/05/25/24809.html#Feedback0http://m.shnenglu.com/dqchen/comments/commentRss/24809.htmlhttp://m.shnenglu.com/dqchen/services/trackbacks/24809.html#include <stdio.h>
#include 
<stdlib.h>
#include 
<vector>

using namespace std;

struct Node 
{
    
int i,j;
    
int value;
}
;

long num[100000];
vector
<Node> matrix;

int main() {
    
long n;
    
long long m;
    scanf(
"%ld %lld",&n,&m);

    
long i,j;
    
for(i = 0;i < n;++i) {
        scanf(
"%ld",&num[i]);
    }


    
for(i = 0;i < n;++i) {
        
if(num[i] > m) {
            
break;
        }

    }


    
if(i < n) {
        printf(
"-1\n");

        
return 0;
    }


    
long long res = -1;
    
long long sum;
    
long max,min = 0;
    
for(i = 0;i < n;++i) {
        
if(i > 0{
            min 
= 1000000;
            
for(j = 0;j < matrix.size();++j) {
                
if(matrix[j].j == i - 1 && matrix[j].value < min) {
                    min 
= matrix[j].value;
                }

            }

        }

        
else {
            min 
= 0;
        }


        sum 
= 0;
        Node node;
        max 
= -1;
        
for(j = i;j < n;++j) {
            sum 
+= num[j];
            
if(sum <= m) {
                
if(max < num[j]) {                    
                    max 
= num[j];
                }

                node.i 
= i;
                node.j 
= j;
                node.value 
= max + min;
                matrix.push_back(node);
                
if(j == n - 1{
                    
if(res != -1{
                        
if(node.value < res) {
                            res 
= node.value;
                        }

                    }

                    
else {
                        res 
= node.value;
                    }

                }

            }

            
else {
                
break;
            }

        }

    }

    
    printf(
"%lld\n",res);

    
return 0;
}


Dain 2007-05-25 10:06 发表评论
]]>
不要再犯低的错?/title><link>http://m.shnenglu.com/dqchen/archive/2007/05/24/24753.html</link><dc:creator>Dain</dc:creator><author>Dain</author><pubDate>Thu, 24 May 2007 05:56:00 GMT</pubDate><guid>http://m.shnenglu.com/dqchen/archive/2007/05/24/24753.html</guid><wfw:comment>http://m.shnenglu.com/dqchen/comments/24753.html</wfw:comment><comments>http://m.shnenglu.com/dqchen/archive/2007/05/24/24753.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/dqchen/comments/commentRss/24753.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/dqchen/services/trackbacks/24753.html</trackback:ping><description><![CDATA[<span style="FONT-SIZE: 10pt">最q,L犯非怽U的错误<br>看题不仔l?br>j误写成kQ而且怪的是,试的例子都通过了,后来通过debug才找Cq个很低U的错误<br><br>真是气h?br><br>不要再犯?/span> <img src ="http://m.shnenglu.com/dqchen/aggbug/24753.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/dqchen/" target="_blank">Dain</a> 2007-05-24 13:56 <a href="http://m.shnenglu.com/dqchen/archive/2007/05/24/24753.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>列出所?位数Q它的前n位能被n整除http://m.shnenglu.com/dqchen/archive/2007/04/16/22030.htmlDainDainMon, 16 Apr 2007 09:29:00 GMThttp://m.shnenglu.com/dqchen/archive/2007/04/16/22030.htmlhttp://m.shnenglu.com/dqchen/comments/22030.htmlhttp://m.shnenglu.com/dqchen/archive/2007/04/16/22030.html#Feedback5http://m.shnenglu.com/dqchen/comments/commentRss/22030.htmlhttp://m.shnenglu.com/dqchen/services/trackbacks/22030.html最单的是穷举,不过那可要O(9*109)Q不可取 

#include <iostream>
#include 
<vector>
#include 
<algorithm>

using namespace std;

vector
<int> fun(int n)
{
    vector
<int> last,all;
    
int i,j,k;
    
for(i = 1;i < 10;++i)
        all.push_back(i);

    
if(n == 1)
        
return all;

    
int size;
    
int num;
    
for(i = 2;i <= n;++i)
    
{
        last 
= all;
        all.clear();
        size 
= (int)last.size();
        
for(j = 0;j < size;++j)
        
{
            
for(k = 0;k < 10;++k)
            
{
                num 
= last[j] * 10 + k;
                
if(num % i == 0)
                    all.push_back(num);
            }

        }

        last.clear();
    }


    
return all;
}


Dain 2007-04-16 17:29 发表评论
]]>
最大的子序列和问题http://m.shnenglu.com/dqchen/archive/2007/02/07/18500.htmlDainDainWed, 07 Feb 2007 02:52:00 GMThttp://m.shnenglu.com/dqchen/archive/2007/02/07/18500.htmlhttp://m.shnenglu.com/dqchen/comments/18500.htmlhttp://m.shnenglu.com/dqchen/archive/2007/02/07/18500.html#Feedback7http://m.shnenglu.com/dqchen/comments/commentRss/18500.htmlhttp://m.shnenglu.com/dqchen/services/trackbacks/18500.html求解该问题的四种法Q?br /> O(N3)Q?/em>法一
int  MaxSubsequenceSum( const   int  A[], int  N)
{
    
int
 ThisSum,MaxSum,i,j,k;
    
    MaxSum 
=   0
;
    
for (i  =   0 ;i  <  N;i ++
)
        
for (j  =  i;j  <  N;j ++
)
        
{
            ThisSum 
=   0
;
            
for (k  =  i;k  <=  j;k ++ )    ThisSum  +=
 A[k];                
            
if (ThisSum  >  MaxSum)    MaxSum  =
 ThisSum;
        }

        
    
return  MaxSum;
}
O(N2)Q?/em>法?/strong>
int  MaxSubsequenceSum( const   int  A[], int  N)
{
    
int
 ThisSum,MaxSum,i,j;
    
    MaxSum 
=   0
;
    
for (i  =   0 ;i  <  N;i ++
)
    
{
        ThisSum 
=   0
;
        
for (j  =  i;j  <  N;j ++
)
        
{
            ThisSum 
+=
 A[k];                
            
if (ThisSum  >  MaxSum)    MaxSum  =
 ThisSum;
        }

    }

        
    
return  MaxSum;
}
O(NlogN)Q算法三
static   int  MaxSubSum( const   int  A[], int  Left, int  Right)
{
    
int
 MaxLeftSum,MaxRightSum;
    
int
 MaxLeftBorderSum,MaxRightBorderSum;
    
int
 LeftBorderSum,RightBorderSum;
    
int
 Center,i;
    
    
if (Left  ==
 Right)
        
if (A[left]  >   0 )     return
 A[left];
        
else      return   0
;
            
    Center 
=  (Left  +  Right)  /   2
;
    MaxLeftSum 
=
 MaxSubSum(A,Left,Center);
    MaxRightSum 
=  MaxSubSum(A,Center  +   1
,Right);
    
    MaxLeftBorderSum 
=   0
;
    LeftBorderSum 
=   0
;
    
for (i  =  Center;i  >=  Left;i --
)
    
{
        LeftBorderSum 
+=
 A[i];
        
if (LeftBorderSum  >  MaxLeftBorderSum)    MaxLeftBorderSum  =
 LeftBorderSum;
    }

    
    MaxRightBorderSum 
=   0 ;
    RightBorderSum 
=   0
;
    
for (i  =  Center  +   1 ;i  <=  Right;i ++
)
    
{
        RightBorderSum 
+=
 A[i];
        
if (RightBorderSum  >  MaxRightBorderSum)    MaxRightBorderSum  =
 RightBorderSum;
    }

    
    
return  Max3(MaxLeftSum,MaxRightSum,MaxLeftBorderSum  +  MaxRightBorderSum);
}


int  MaxSubsequenceSum( const int  A[],int  N)
{
    
return  MaxSubSum(A, 0 ,N  -   1
);    
}
O(N)Q算法四
intMaxSubsequenceSum( const int  A[], int  N)
{
    
int  ThisSum,MaxSum,i;
    
    ThisSum 
=  MaxSum  =   0 ;
    
for (i  =   0 ;i  <  N;i ++ )
    
{
        ThisSum 
+=  A[i];
        
if (ThisSum  >  MaxSum)
            MaxSum 
=  ThisSum;
        
else
            ThisSum 
=   0 ;
    }

    
    
return  MaxSum;
}


参考《数据结构与法分析?/font>



Dain 2007-02-07 10:52 发表评论
]]>
~写递归四条基本法则http://m.shnenglu.com/dqchen/archive/2007/01/31/18234.htmlDainDainWed, 31 Jan 2007 13:03:00 GMThttp://m.shnenglu.com/dqchen/archive/2007/01/31/18234.htmlhttp://m.shnenglu.com/dqchen/comments/18234.htmlhttp://m.shnenglu.com/dqchen/archive/2007/01/31/18234.html#Feedback0http://m.shnenglu.com/dqchen/comments/commentRss/18234.htmlhttp://m.shnenglu.com/dqchen/services/trackbacks/18234.html
  • 基准情Ş。必要有某些基准情形,它无递归p解出Q也是要有退出递归的条件?/font>
  • 不断推进。对于那些需要递归求解的情形,每一ơ递归调用都必要使求解状冉|接近基准情Ş的方向推q?/font>
  • 设计法则。假设所有的递归调用都能q行?/font>
  • 合成效益。求解一个问题的同一个实例时Q切勿在不同的递归调用中做重复性的工作?/font>


  • Dain 2007-01-31 21:03 发表评论
    ]]>
    M计划http://m.shnenglu.com/dqchen/archive/2007/01/31/18230.htmlDainDainWed, 31 Jan 2007 12:07:00 GMThttp://m.shnenglu.com/dqchen/archive/2007/01/31/18230.htmlhttp://m.shnenglu.com/dqchen/comments/18230.htmlhttp://m.shnenglu.com/dqchen/archive/2007/01/31/18230.html#Feedback1http://m.shnenglu.com/dqchen/comments/commentRss/18230.htmlhttp://m.shnenglu.com/dqchen/services/trackbacks/18230.html遇到了好多不能解决的问题后,觉得应该重新读读书了
    最q买了几本书
    《More Effective CPP?br />《Effective STL?br />《ƈ行程序设计?br />《数据结构与法分析——C语言描述?/font> 


    Dain 2007-01-31 20:07 发表评论
    ]]>
    引用和指针参数的关系http://m.shnenglu.com/dqchen/archive/2007/01/19/17773.htmlDainDainFri, 19 Jan 2007 01:56:00 GMThttp://m.shnenglu.com/dqchen/archive/2007/01/19/17773.htmlhttp://m.shnenglu.com/dqchen/comments/17773.htmlhttp://m.shnenglu.com/dqchen/archive/2007/01/19/17773.html#Feedback1http://m.shnenglu.com/dqchen/comments/commentRss/17773.htmlhttp://m.shnenglu.com/dqchen/services/trackbacks/17773.html两种参数都允许函C改实参指向的对象Q都允许有效地向函数传递大cd对象。所以怎么样决定把函数参数声明成引用还是指针呢Q?br />引用必须被初始化为指向一个对象,一旦初始化了,它就不能再指向其他对象。指针可以指向一pd不同的对象也可以什么都不指向?br />因ؓ指针可能指向一个对象或没有M对象Q所以函数在定指针实际指向一个有效的对象之前不能安全解引用一个指针。如Q?br />
    class  X;
    void  fun(X  * x)
    {
      
    //  在解引用指针之前信它非0
       if (x  !=   0 )
        
    //  解引用指?/span>
    }
      
    而,对于引用参数Q函C需要保证它指向一个对象。引用必L向一个对象,不希望向指针那样q行解引用。如Q?br />
    class Type;
    void op(const Type &t1,const Type &t2);

    int main()
    {
      Type obj1;
      
    // 讄obj1为某个?br />
      
    // 错误Q引用参数的实参不能?
      op(obj1,0);

      
    // 
      return 0;
    }
    如果一个参数可能在函数中指向不同的对象Q或者这个参数可能不指向M对象Q则必须使用指针参数?br />引用参数的一个重要用法,它允许有效地实现重蝲操作W的同时Q还能保证用法的直观性。可以参考《C++ Primer?br />
    ps 发现?87늚W二个程序例子是错的


    Dain 2007-01-19 09:56 发表评论
    ]]>
    青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
      <noscript id="pjuwb"></noscript>
            <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
              <dd id="pjuwb"></dd>
              <abbr id="pjuwb"></abbr>
              ޹ƷӰ| ۺɫվ| ޵һ| ŷպ| ҹҹˬavƷ| ھƷþþ| ѳ˸Ƶ| պ㽶Ƶ| þݺҹҹav| ߳˾Ʒ| þðwww.| | ޾Ʒ| ŷ| ŷ޾Ʒһ | Ѳŷ| ŷպƷһ| ŷɫƵ| Ĺ˾Ʒ| þþþƷƵ| ŷþþþþþþþ| ˾þþþþվƵ | ŷҳ| 99ۺϾƷ| þþƷһ| ƷþòҰ| ޸Ƶר| ߲Ƶ| ŷ˾Ʒһ| þþƷ| 97þ| һ| ŷר߲| ޾Ʒ| þۺɫۺɫ88| ߹ۿһ| 18þ| ޵һҳ| ҹһ| ŷ| ޾ƷƵĻ| Ůþ| ޹պ| ţţƷƵ| þþ| ۺƵ| ŷƷþ| þþþþþþþþþþþһ| ƷƵѹۿ| þƬҹӰ| ۺɫ| ŷ| þþþ| ŷҹƵ| լ66պ߹ۿ| ˳վ߹ۿ| ŷպ˾Ʒ| һ| ŷĻ| һ| ŷƵ| ŷһѲ| þƵۿ| ŷþƷ| Ʒþþþһ| ޸Ƶ| ˳߹ۿ| þþƷ999߽| һҹ| ޸Ƶվ| ɫ| þ㽶Ʒһ| | av˶| һþþþ| Ʒa˳| ޶Ƶ| 99߾Ʒۿ| ŷպۺ| ľƷƵһ߹ۿ| һۿ| þۺϾɫۺϾ99| Ʒۺþþþ| ȾƷƵ| պŷƵһ| ۺŷƵ| ƷþëƬa| ŷһ߹ۿ| 99þþƷþþþþ | Ʒҹ߹ۿ| ҹƷ| ŷһƵ| պƵ| avһ| ŷƷվ| þþƷ30| һwww| ŷСƵ| Ʒާѡ| avһ| ŷպۺ| ѾƵ| ŷɫ| һ| 99ƵƷȫ| ޻ҳһ| þ۲ݾƷþþþƷ| Ƶ߹ۿŷ| þþƷһ| ޹˾þۺһ| ŷƵһ| þóۺɫ| ŷһ| ŷƷsuv| ۺɫ| Ƶһ߹ۿ| ޹Ʒƾþ| ѲŷƵ| þþž99| þþøһ| ŷ߹ۿձһ| þҰսav| ޳ɫ777777Ůɫ| ëƬ| ŷ߹ۿƵ | þ鶹| ëƬػƾþþþþ| þ͵wcŮ͵| ҹһ߹ۿ| þ| þһ| ޳Ƶ | ƷĻŷ| ŷ| Ƶ| ŷƵһ| ׵Ӱ| ŷsmƵ| ӰȷĻһ| һ|ҹ| 鶹Ʒ91þþþþ| һƵ| ŷպѸ| պһƷƵ| þˬˬˬþ| һ㶮| ŷaһƵ| ޾Ʒһ| һav˾þۺ| þ㽶Ʒ| þþƷһ| ߹ۿպav| ޵Ӱ| ŷƷþþþþðĦ| ޹һ| Ů޾Ʒһ| þþƵ| ĻպƷ| ŷպһ| ³ʦӰԺһ| 1024Ʒһ| ޸Ƶ| Ʒþþþþһ | ŷһƬaaaaaaaƵ| պav| ɫۺϲƵ| ۺ| ŷһ| ŷһƵ| þȷԴ| ŷһ| ŮƷþ| ŷһ߲| ywҹƷƵ| ޾Ʒһ| һ߹ۿ| պһƷƵ߹ۿ| ޼Ƶ| ƴƬ| 91þþ| þþҹӰ| ŷһƵ97| ŷ˳| ŷƵۿ| ھƷþþþþ | þۺ77777| ҹƵ| þĻ| ѳwww| ɫ˾Ʒվ| þþ97Ʒ| Կavվþÿ| һѲ | ŷƵѲ| Ƶһ| Ʒҹɫ7777| þƷ| ȹƷƵ| ߲պ| ŷɫƵ|