锘??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美成人免费观看久久,99久久精品费精品国产,亚洲精品tv久久久久http://www.shnenglu.com/newplan/闃垮熀綾沖痙鍦ㄦ礂婢℃檪鐧肩従嫻姏鍘熺悊錛岄珮鑸堝緱渚嗕笉鍙婄┛銌栬げ瀛愶紝璺戝埌琛椼問澶у枈錛欵ureka錛堟垜鎵懼埌浜嗭級銆?/description>zh-cnSat, 10 May 2025 23:53:24 GMTSat, 10 May 2025 23:53:24 GMT60鑷繁鍔ㄦ墜鍒朵綔寮哄姏緗戠粶鐖櫕http://www.shnenglu.com/newplan/archive/2008/12/21/70012.html灞辨硥寮歡灞辨硥寮歡Sun, 21 Dec 2008 12:38:00 GMThttp://www.shnenglu.com/newplan/archive/2008/12/21/70012.htmlhttp://www.shnenglu.com/newplan/comments/70012.htmlhttp://www.shnenglu.com/newplan/archive/2008/12/21/70012.html#Feedback0http://www.shnenglu.com/newplan/comments/commentRss/70012.htmlhttp://www.shnenglu.com/newplan/services/trackbacks/70012.html闃呰鍏ㄦ枃

]]>
java綰跨▼姹犵殑浣跨敤http://www.shnenglu.com/newplan/archive/2008/12/13/69361.html灞辨硥寮歡灞辨硥寮歡Sat, 13 Dec 2008 11:04:00 GMThttp://www.shnenglu.com/newplan/archive/2008/12/13/69361.htmlhttp://www.shnenglu.com/newplan/comments/69361.htmlhttp://www.shnenglu.com/newplan/archive/2008/12/13/69361.html#Feedback0http://www.shnenglu.com/newplan/comments/commentRss/69361.htmlhttp://www.shnenglu.com/newplan/services/trackbacks/69361.htmlimport java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;


/*
 * 瀛︿範浣跨敤JDK5浠ヤ笂鐨勭嚎紼嬫睜鎿嶄綔
 
*/


public class ThreadPool {

    
public static void main(String[] args)
    
{
            
/*
             * 鍙互瀹夋帓綰跨▼榪愯鏃墮棿
             * 
             
*/

        
            
final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(2);
            
final Runnable beeper = new Runnable() 
            
{     
                
int count = 0
                
public void run() 
                
{        
                    System.out.println( 
" beep " + (++count));
                    
                }
    
            }
;
            
final ScheduledFuture<?> beeperHandle = scheduler.scheduleAtFixedRate(beeper, 12,TimeUnit.SECONDS);
            
            scheduler.schedule(
new Runnable() 
                                
{      
                                    
public void run()
                                    
{        
                                        beeperHandle.cancel(
true);   
                                        scheduler.shutdown();
                                    }
    
                                }
200, TimeUnit.SECONDS
                                );
            
/*
             * 涓嶅彲浠ュ畨鎺掔嚎紼嬬殑榪愯鏃墮棿
             
*/

            ExecutorService    exec 
= Executors.newFixedThreadPool(2);    
            
for(int index = 0; index < 200; index++
            
{
                Runnable run 
= new Runnable()
                
{
                    
public void run() 
                    
{   long time =(long)(Math.random() * 1000);
                        System.out.println(
"Sleeping " + time + "ms");
                        
try 
                            Thread.sleep(time);
                            }
 catch (InterruptedException e)
                            
{           
                                
                            }
        
                    }

                }
;
                exec.execute(run);    
            }

            exec.shutdown();  
    
    }

    
    
}


]]>
C++鏅鴻兘鎸囬拡鐨勪嬌鐢ㄧず渚?/title><link>http://www.shnenglu.com/newplan/archive/2008/10/16/64194.html</link><dc:creator>灞辨硥寮歡</dc:creator><author>灞辨硥寮歡</author><pubDate>Thu, 16 Oct 2008 12:12:00 GMT</pubDate><guid>http://www.shnenglu.com/newplan/archive/2008/10/16/64194.html</guid><wfw:comment>http://www.shnenglu.com/newplan/comments/64194.html</wfw:comment><comments>http://www.shnenglu.com/newplan/archive/2008/10/16/64194.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/newplan/comments/commentRss/64194.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/newplan/services/trackbacks/64194.html</trackback:ping><description><![CDATA[<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;"><br>#include </span><span style="color: #000000;"><</span><span style="color: #000000;">iostream</span><span style="color: #000000;">></span><span style="color: #000000;"><br>#include </span><span style="color: #000000;"><</span><span style="color: #000000;">String</span><span style="color: #000000;">></span><span style="color: #000000;"><br></span><span style="color: #0000ff;">using</span><span style="color: #000000;"> </span><span style="color: #0000ff;">namespace</span><span style="color: #000000;"> std;<br></span><span style="color: #0000ff;">class</span><span style="color: #000000;"> ia{<br>      </span><span style="color: #0000ff;">public</span><span style="color: #000000;">:<br>      ia(</span><span style="color: #0000ff;">string</span><span style="color: #000000;"> a){</span><span style="color: #0000ff;">this</span><span style="color: #000000;">-></span><span style="color: #000000;">a</span><span style="color: #000000;">=</span><span style="color: #000000;">a;}<br>      </span><span style="color: #000000;">~</span><span style="color: #000000;">ia(){cout</span><span style="color: #000000;"><<</span><span style="color: #000000;">"</span><span style="color: #000000;">~</span><span style="color: #000000;">"</span><span style="color: #000000;"><<</span><span style="color: #000000;">a</span><span style="color: #000000;"><<</span><span style="color: #000000;">endl;getchar();}<br>      </span><span style="color: #0000ff;">private</span><span style="color: #000000;">:<br>              </span><span style="color: #0000ff;">string</span><span style="color: #000000;"> a;<br>      };<br></span><span style="color: #0000ff;">int</span><span style="color: #000000;"> main()<br>{<br>    auto_ptr</span><span style="color: #000000;"><</span><span style="color: #000000;">ia</span><span style="color: #000000;">></span><span style="color: #000000;"> ap(</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> ia(</span><span style="color: #000000;">"</span><span style="color: #000000;">newplan</span><span style="color: #000000;">"</span><span style="color: #000000;">));<br>    ia </span><span style="color: #000000;">*</span><span style="color: #000000;">bp </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #0000ff;">new</span><span style="color: #000000;"> ia(</span><span style="color: #000000;">"</span><span style="color: #000000;">zhaoziming</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>    </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> </span><span style="color: #000000;">1</span><span style="color: #000000;">;<br>}<br></span></div> <br><img src ="http://www.shnenglu.com/newplan/aggbug/64194.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/newplan/" target="_blank">灞辨硥寮歡</a> 2008-10-16 20:12 <a href="http://www.shnenglu.com/newplan/archive/2008/10/16/64194.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>myshell.shhttp://www.shnenglu.com/newplan/archive/2008/09/17/62018.html灞辨硥寮歡灞辨硥寮歡Tue, 16 Sep 2008 16:05:00 GMThttp://www.shnenglu.com/newplan/archive/2008/09/17/62018.htmlhttp://www.shnenglu.com/newplan/comments/62018.htmlhttp://www.shnenglu.com/newplan/archive/2008/09/17/62018.html#Feedback1http://www.shnenglu.com/newplan/comments/commentRss/62018.htmlhttp://www.shnenglu.com/newplan/services/trackbacks/62018.htmlbash myshell.sh
*/
echo "doing jobs...."
yacc -d  b3.y
lex   b3.l
cc lex.yy.c  y.tab.c -o b3
echo "jobs end."


]]>
B3.Lhttp://www.shnenglu.com/newplan/archive/2008/09/17/62017.html灞辨硥寮歡灞辨硥寮歡Tue, 16 Sep 2008 16:01:00 GMThttp://www.shnenglu.com/newplan/archive/2008/09/17/62017.htmlhttp://www.shnenglu.com/newplan/comments/62017.htmlhttp://www.shnenglu.com/newplan/archive/2008/09/17/62017.html#Feedback0http://www.shnenglu.com/newplan/comments/commentRss/62017.htmlhttp://www.shnenglu.com/newplan/services/trackbacks/62017.html/*
緙栬瘧鍘熺悊瀹為獙3
B3.L
*/
%{
#include"y.tab.h"
#include<string.h>
extern FILE * yyin;
extern FILE * yyout;
extern int yylineno;
%}

delim      [  \t]
ws           {delim}+
letter       [A-Za-z]
digit        [0-9]
id           {letter}({letter}|{digit})*
number       {digit}+
addop        [+-]
mulop        [*/]
%%
\r\n         {yylineno++;}
{ws}         {/*d*/}
while        {return WHILE;}
do           {return DO;}
if           {return IF;}
else         {return ELSE;}
for          {return FOR;}
int          {return INT;}
char         {return CHAR;}
void         {return VOID;}
return       {return RETURN;}
\'[a-zA-Z0-9]\'    {strcpy(yylval._ident,yytext);return CONST_CHAR;}
\"[a-zA-Z]+\" {strcpy(yylval._ident,yytext);return STRING;}
{id}         {strcpy(yylval._ident,yytext);return ID;}
{number}     {strcpy(yylval._ident,yytext);return NUM;}
"["          {return '[';}
"]"          {return ']';}
"<"          {return LT;}
"="          {return '=';}
">"          {return GT;}
"<="         {return LE;}
">="         {return GE;}
"!="         {return NE;}
"=="         {return EQ;}
{addop}      {yylval._op=yytext[0]; return ADDOP;}
{mulop}      {yylval._op=yytext[0]; return MULOP;}
";"          {return ';';}
"{"          {return '{';}
"}"          {return '}';}
"("          {return '(';}
")"          {return ')';}
","          {return ',';}
%%
int yywrap(){
   return 1;
}



]]>
B3.Yhttp://www.shnenglu.com/newplan/archive/2008/09/17/62016.html灞辨硥寮歡灞辨硥寮歡Tue, 16 Sep 2008 16:00:00 GMThttp://www.shnenglu.com/newplan/archive/2008/09/17/62016.htmlhttp://www.shnenglu.com/newplan/comments/62016.htmlhttp://www.shnenglu.com/newplan/archive/2008/09/17/62016.html#Feedback0http://www.shnenglu.com/newplan/comments/commentRss/62016.htmlhttp://www.shnenglu.com/newplan/services/trackbacks/62016.html/*
緙栬瘧鍘熺悊瀹為獙涓夊疄楠屼唬鐮?br>B3.Y
newplan
08-09-16
*/
%{
/*-----------head file---------*/
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
/*-----------macros------------*/
#define  HASHSIZE  128
#define _INT  34
#define _CHAR 35
#define _VOID 36
#define _STRING 37
#define _FUNC_TYPE 38
#define _ERROR 39
extern  int yylex();
extern  FILE*  yyin;
extern  FILE*  yyout;
int     yylineno;

typedef struct {
int a[5];
int n;
int h;
int ret_type;
}param;
/*¶¨Òå±êʶ·û*/
typedef struct {
char name[10];
int  scope;/*ËùÔڵIJã´Î*/
int  type;/*±êʶ·ûÀàÐÍ*/
param  *p;
}symbol;

/*¶¨ÒåhashͰ*/
struct sym_entry{
symbol sym;
struct sym_entry  *next ;
};

/*¶¨ÒåhashÁ´±í*/
struct table {
int level ;
struct table *previous;
struct  sym_entry  *buckets[HASHSIZE] ;
};

int    table_len = 0;/*ÓжàÉÙ¸ö±í*/
struct table *table_stack[100];/*±íÕ»*/
struct table *global_table ;/*È«¾Ö±íÖ¸Õë*/
param  *global_func_p;
int    level  = 0 ;/*È«¾Ö²ã´ÎÉèÖÃΪ 0 */
int    error  = 0;
int    trace  = 0;

/*hash º¯Êý*/
int hash(char *s)
{
  char *p ;
  unsigned h = 0,g=0;
  for(p=s ;*p != '\0' ;p++)
   {
   h=(h<<4)+(*p) ;

   if(g=h & 0xf0000000)
   {
   h=h^(g>>24);
   h=h^g;
   }
   }
  return h%128;
}
/*----------------²éÕÒ·ûºÅ±í------------------*/
symbol *lookupall(char *name,struct table *tp)
{
  int  h =hash(name);
  struct sym_entry *p = NULL;
  int tag=0;
  do
  {
   if(tp->level ==level && tag >0 )continue;
   for(p = tp->buckets[h];p;p=p->next)
   if(!strcmp(name,p->sym.name)) return &p->sym ;
   tag = 1 ;
  }
  while(tp=tp->previous);
  return  NULL;
}
/*---------------------------------------------*/
symbol *lookup(char *name,struct table *tp)
{
int h= hash(name);
struct sym_entry *p =NULL;
for(p = tp->buckets[h];p;p = p->next)
   if(!strcmp(name,p->sym.name)){return  &p->sym ;}

return  NULL;
}

/*---------------´´½¨Ò»¸ö·ûºÅ±í----------------*/
struct table * mktable(struct table *previous ,int level)
{
struct table *new =(struct table *)malloc(sizeof *new);
new->previous = previous ;
new->level = level ;
int  i;
for(i= 0; i<HASHSIZE ;i++)new->buckets[i]=0;
return new;
}


/*---------------²åÈëÒ»¸ö±êʶ·û----------------*/
symbol *insert(char *name,struct table *tpp)
{
int h = hash(name);
struct  table *tp = tpp;
struct  sym_entry *p =(struct sym_entry *)malloc(sizeof *p);
if(tp->level<level)
{
tp =(struct table *)mktable(tp,level);
table_stack[table_len] = tp ;
table_len ++;
}
strcpy(p->sym.name,name);
p->sym.scope= level;
p->sym.type = 0;
p->next = tp->buckets[h];
tp->buckets[h]=p;
return  &p->sym ;
}

%}
%start program
%right '='
%left ADDOP
%left '*' '/'
%left LE LT GT GE EQ NE
%union {char _ident[9]; int value;char _op;};
%token <_ident> ID 
%token NUM
%token <_ident> STRING
%token IF
%token ELSE
%token WHILE
%token INT
%token CHAR
%token <_ident> CONST_CHAR
%token VOID
%token RETURN
%token FOR
%token DO
%token <_op>     ADDOP
%type  <value>   type_specifer
%type  <value>   var
%type  <value>   factor
%type  <value>   term
%type  <value>   additive_expression
%type  <value>   simple_expression
%type  <value>   expression
%type  <value>   arg_list
%token  <_op>    MULOP
%nonassoc IFX
%nonassoc ELSE
%%
program         :  M    declaration_list {if(1 == trace)printf("program ==> M declaration_list.\n");if(error == 0 ) fprintf(yyout,"no error\n");}
  ;
M               : {
                 global_table = mktable(NULL,0);
                 table_stack[table_len] = global_table ;
                 table_len++;
               }
                ;
declaration_list: declaration_list declaration
{
 if(trace == 1) fprintf(yyout,"declaration_list ==> declaration_list  declaration.\n");
}
  | declaration
{
 if(trace == 1) fprintf(yyout,"declaration_list ==> declaration.\n");
}
               ;
declaration     :var_declaration
{
if (trace ==1) fprintf(yyout,"declaration ==> var_declaration.\n");
}
                |fun_declaration
{
if (trace ==1) fprintf(yyout,"declaration ==> fun_declaration.\n");
}
                ;
var_declaration :type_specifer ID ';'
                {
                  if(trace == 1) printf("var_declaration ==>type_specifer ID.\n");
                  struct table *tp = table_stack[table_len-1];
                  if(lookup($2,tp) == NULL)
                 {
                  symbol *p = insert($2,tp);
                  p->type = $1 ;
                 }
                 else {error = 1 ; fprintf(yyout, "line %d:error:%s:redefinition\n ",yylineno,$2);}
                }
                |type_specifer ID '[' NUM ']' ';'
                ;
type_specifer   :INT {$$ =_INT ;}             
                |CHAR {$$ = _CHAR;}
                |VOID {$$ =_VOID ;}
                ;
fun_declaration :type_specifer  fun_tag '('  LL  params ')' compound_stmt {level--;}
                |type_specifer  fun_tag '('  LL  params ')' ';'{level--;}
                ;
fun_tag         : ID
{
  struct table *tp = table_stack[table_len-1];
  symbol *tmp ;
  tmp = lookupall($1,tp);
  if(tmp == NULL)
  {tmp =insert($1,tp);
   global_func_p = tmp->p = (param *)malloc(sizeof(*tmp->p));
   global_func_p->n =0 ;
   global_func_p->ret_type = _INT ;
   tmp->type =_FUNC_TYPE;
  }
  else
  {error = 1 ; fprintf(yyout,"line %d:error %s redefine of function.\n",yylineno,$1);}
}
                ;
LL:             {level++;
                 struct table *tp = mktable(table_stack[table_len-1],level);
                 table_stack[table_len]=tp;
                 table_len++;
                 if(1==trace)printf("level = %d \n",level);
                }
                ;
params          :param_list
                |VOID{global_func_p->n = 0; if(1 == trace)printf("params==>void\n");}
                ;
param_list      :param_list ',' param {if(1 ==trace )printf("param_list ==> param_list , param.\n");}
                |param
                ;
param           :type_specifer ID
                {
                   struct table *tp =table_stack[table_len-1];
                   symbol *p =insert($2,tp);
                   p->type =$1;
                   global_func_p->a[global_func_p->n++]= $1 ;
                //   printf("type[%d]=%d\n",global_func_p->n-1,global_func_p->a[global_func_p->n-1]);
                 }
                ;
compound_stmt   :'{' local_declarations statement_list '}'
                ;
local_declarations:  local_declarations var_declaration{if(1 ==trace )printf("local_declarations ==>loacal_declarations var_declaration\n");}
  |{if(1 == trace )printf("local_declarations ==>  .\n");}
                ;
statement_list  :statement_list statement
                |{}
                ;
statement       :expression_stmt{if(1 == trace )printf("statement ==> expression_stmt.\n");}
                |if_stmt
                |compound_stmt
                |while_stmt
                |return_stmt             
;
expression_stmt :expression ';'
                |';'
                ;
if_stmt         :IF '(' expression ')' statement %prec IFX {if(1== trace)printf("if_stmt ==> if expression statement .\n");}
                |IF '(' expression ')' statement ELSE statement
{if(1==trace )printf("if_Stmt ==> if expression statement else statement.\n");}                 ;
while_stmt      :WHILE '(' expression ')' statement
                ;
return_stmt     :RETURN ';'
                |RETURN expression ';'
                ;
expression      :var '=' expression{if($1 != $3){error =1 ;printf("line %d:  '='  must be same type.\n",yylineno);}if(1 == trace )printf("expression ==>var = expression.\n");}
                |simple_expression {$$  ==  $1 ;}
                ;
var             :ID {
                     symbol *p = lookupall($1,table_stack[table_len-1]);
                   
                     if(NULL==p){$$ = _ERROR ;error =1 ;fprintf(yyout,"line %d undeclared identifier %s\n",yylineno,$1);}
                     else
                     $$ =p->type ;
                   
                   }
                ;
simple_expression:additive_expression relop additive_expression{if($1==_INT && $3 ==_INT || $1 ==_CHAR && $3 == _CHAR){;}else{ error =1 ;printf("line %d :relop must int int or char char.\n",yylineno);}}
                 |additive_expression{$$ =$1 ;}
                 ;
relop            :LE
                 |LT
                 |GT
                 |GE
                 |EQ
                 |NE
;
additive_expression:additive_expression ADDOP term {if($1 == _INT && $3 ==_INT){;}else{error =1 ;printf("line%d :addop must int int .\n",yylineno);}if(1==trace)printf("additive_expression ==>additive_expression ADDOP term.\n");}
                |term{$$ = $1 ;}
                ;
term            :term MULOP factor {if($1==_INT && $3 ==_INT ){;}else{error = 1 ;printf("\nline%d :mulop must int int.\n",yylineno);}}
  |factor {$$ =$1;}
  ;
factor          :'(' expression ')'
  |var {$$ = $1;}
  |call{if(global_func_p){$$=global_func_p->ret_type;}}
  |NUM {$$ = _INT;}
                |STRING {$$ =_STRING;}
                |CONST_CHAR {$$ = _CHAR ;}
  ;
call  :ID { symbol *tmp =lookupall($1,table_stack[table_len-1]);if(NULL ==tmp||tmp->type!=_FUNC_TYPE){error =1;printf("line%d :undeclared identifier %s.\n",yylineno,$1);}else {global_func_p = tmp->p;global_func_p->h = 0;}
} '(' args ')' {if(1 == trace )printf("call ==> ID args .\n");}
  ;
args  :arg_list{if(global_func_p->n > global_func_p->h){error=1;printf("line%d :param num error.\n",yylineno);}}
  |{if(global_func_p->n != 0){error =1 ;printf("line%d :param error.\n",yylineno);}}
  ;
arg_list        :arg_list ',' expression{if(global_func_p->n<=global_func_p->h){error=1 ;printf("line%d :param num error.\n",yylineno);}else if(global_func_p->a[global_func_p->h]!=$3){error =1 ;printf("line%d :param error %d.\n",yylineno,$3);}else{global_func_p->h++;}}
  |expression {$$ =$1 ; if(global_func_p->a[global_func_p->h]!=$1){error =1 ;printf("line%d :param error $1=%d.\n",yylineno,$1);}else{global_func_p->h++;}}

  ;

%%
int main(int argc,char *argv[])
{
      printf("start checking...\n");
      yylineno=1;
      if(argc==3)
      {
  yyin=fopen(argv[1],"r");
         yyout=fopen(argv[2],"w");
      }
      else if(argc==2)
 { yyin=fopen(argv[1],"r");
                yyout = stdout ;
        }
      yyparse();
      return 0;
}
int yyerror(char *string)
{
     printf("error:%s in line %d\n",string,yylineno);
     return 0;
}



]]>
鏁板煎垎鏋愭柟闃電殑QR鍒嗚Вhttp://www.shnenglu.com/newplan/archive/2008/06/24/54439.html灞辨硥寮歡灞辨硥寮歡Tue, 24 Jun 2008 02:52:00 GMThttp://www.shnenglu.com/newplan/archive/2008/06/24/54439.htmlhttp://www.shnenglu.com/newplan/comments/54439.htmlhttp://www.shnenglu.com/newplan/archive/2008/06/24/54439.html#Feedback0http://www.shnenglu.com/newplan/comments/commentRss/54439.htmlhttp://www.shnenglu.com/newplan/services/trackbacks/54439.htmlfunction[]=iqr()
% 瀹為獙鍚嶇О錛氭柟闃電殑QR鍒嗚В
% 瀹為獙鎻忚堪錛氬厛灝嗘柟闃靛寲涓轟笂嫻風敵鍗氭牸闃碉紝鍐嶇敤QR鍒嗚В娉曟眰涓婃搗鐢沖崥鏍奸樀鐨勭壒寰佸?鍒欐墍寰楀埌鐨勭壒寰佸間篃鏄柟闃電殑鐗瑰緛鍊?br>% 浣滆?newplan
% 瀹為獙瀹屾垚鏃ユ湡錛?鏈?0鍙?br>%涓嬮潰鐨凙涓烘祴璇曚笁闃剁殑鏂歸樀
A
=[5,-3,2;6,-4,4;4,-4,5]
%涓嬮潰鐨凙涓烘祴璇曞洓闃剁殑鏂歸樀
%A 
= [1 2 1 2;2 2 -1 1;1 -1 1 1;2 1 1 1]
%閫氳繃璋冪敤malab鐨勮嚜甯︾殑鍑芥暟姹傚緱A鐨勬墍鏈夌壒寰佸煎拰鐗瑰緛鍚戦噺
%鐗瑰緛鍊間繚瀛樺湪v涓紝鐗瑰緛鍚戦噺淇濆瓨鐨勫湪d涓?灝嗗叾鎵撳嵃鍑烘潵鍜屾垜浠殑綆楁硶綆楀嚭鏉ョ殑鐗瑰緛鍊艱繘琛屽姣?br>[v,d]
=eig(A)
%姹傚嚭琛屽拰鍒楃殑澶у皬
msize
=size(A);
%鍙栧緱鐭╅樀鐨勫垪鏁幫紝鍏跺疄琛屾暟鍜屽垪鏁伴兘涓簄
n
=msize(1);
%鐢熸垚n闃跺崟浣嶉樀
Q
=eye(n);
%鐢╤ousehold鐨勬柟娉曟眰鐭╅樀A鐨勪笂嫻鋒.浼牸闃?br>
for i=1:n-2%浠庣涓鍒楀紑濮嬪埌鍊掓暟絎笁鍒?nbsp;
    %姹傚嚭姣忎竴鍒楃殑鏈澶у?br>    d
=max(abs(A(i+1:n,i)));
    %瑙勮寖鍖?br>    U(i
+1:n,i)=A(i+1:n,i)/d;
    delta
=U(i+1,i)*norm(U(i+1:n,i))/abs(U(i+1,i));
    U(i
+1,i)=U(i+1,i)+delta;
    beta 
= delta*U(i+1,i);
    %姹傚嚭R鐭╅樀鏍規(guī)嵁璇炬湰316P渚嬮涓?nbsp;
    R 
= eye(n-i,n-i)-inv(beta)*U(i+1:n,i)*U(i+1:n,i)';
    u=eye(n,n);
    
for j =i+1:n
        
for k =i+1:n
            u(j,k)
=R(j-i,k-i);
        
end
    
end
    A
=u*A*u;%鐢熸垚鏂扮殑A=u×A×u
end
%error涓烘垜浠瀹氱殑璇樊闄愬埗
error = 0.0000001;
%flag涓哄垽鏂璔R娉曟槸鍚︾戶緇繘琛岀殑鏍囧織浣?br>flag 
=1;
while flag==1
flag 
=0 ;
=A;
= eye(n,n);
%鎸夌収QR鍒嗚В娉曟眰鍑篶os錛?/span>sin 鐒跺悗璁$畻V錛屾渶緇堝緱鍒癛鍜孮
for i=1:n-1
  r 
= norm(R(i:i+1,i));
  icos
=R(i,i)/r;
  isin
=R(i+1,i)/r;
  v
=eye(n,n);
  v(i,i)
=icos;
  v(i
+1,i+1)=icos;
  v(i,i
+1)=isin;
  v(i
+1,i)=-isin;
  R
=v*R;
  Q
=Q*v';
end
%鐢≧
*Q鐨勭粨鏋滃幓鏇挎崲A
=R*Q;
%涓嬮潰榪欎釜寰幆媯嫻婣鐨勭簿搴︽椂鍊欒凍澶燂紝鍘葷湅A鐨勬瀵硅綰垮悇涓厓绱犵殑緇濆鍊兼槸鍚﹀皬浜庤宸檺鍒?br>
for w =2:n
     
if abs(A(w,w-1))>error
     flag 
= 1 ;
     break;%鑻ユ湁鍏朵腑涓涓厓绱犵殑緇濆鍊艱繕鏄ぇ浜庤宸檺鍒跺垯榪樿緇х畫榪涜QR鍒嗚В
    
end   
end
%鍒ゆ柇鐨勮繃紼嬪畬姣?br>
end
%鎶夾鎵撳嵃鍑烘潵
A





]]>
綆楁硶 瀹為獙 4 http://www.shnenglu.com/newplan/archive/2008/06/10/52801.html灞辨硥寮歡灞辨硥寮歡Tue, 10 Jun 2008 13:47:00 GMThttp://www.shnenglu.com/newplan/archive/2008/06/10/52801.htmlhttp://www.shnenglu.com/newplan/comments/52801.htmlhttp://www.shnenglu.com/newplan/archive/2008/06/10/52801.html#Feedback0http://www.shnenglu.com/newplan/comments/commentRss/52801.htmlhttp://www.shnenglu.com/newplan/services/trackbacks/52801.html/*
6.10
*/
/*==========INCLUDES BEGIN===============*/ 
#include 
<cstdlib>
#include 
<iostream>
#include 
<fstream>
#include 
<algorithm>
#include 
<QApplication>
#include 
<QWidget>
#include 
<QPainter>
#include 
<Qt>

/*==========INCLUDE END==================*/ 

/*==========MACROS BEGIN=================*/
#define  MAX        
100000000
#define  BUFFER     
300
#define  INPUTFILE  
"./50.txt"
/*==========MACROS  END==================*/

/*==========STD DECLRARS BEGIN===========*/
using std::cout;
using std::cin;
using std::endl;
using std::ios;
using std::ifstream;
using std::sort;
using std::max;
/*==========STD DECLARS END===============*/

/*============STRUCTS BRGIN===============*/ 
struct 
Space {
       
int x;
       
int y;
       
int w;
       
int h;
       bool v;
//IF VISITED THEN V =TURE ELSE FLASE
       };
struct Gadget
{
       
int x;
       
int y;
       
int w;
       
int h;
};
/*=============STRUCT END=================*/



/*===========GADGET CUT BEGIN=============*/ 
        Gadget  result[BUFFER];
        Gadget  g[BUFFER];
        
int      bestH;
        
Space   space[BUFFER];
        
int spaceNum ;
        
int     W;
        
int     N;
        
int     H;  
        ifstream Fin; 
        
int     deep;   
        clock_t    start;
        clock_t     
end;

/*-------------FRIENDS METHOD--------------------*/
bool mycmpG(Gadget t1,Gadget t2){return t1.h
>t2.h;} 
/*-------------FRIENDS METHOD--------------------*/
 bool mycompS(
Space t1,Space t2){return t1.y<t2.y;}
/*-------------CONSTRUCT METHOD------------------*/
void init()
{   
    Fin.open(INPUTFILE,ios::in);
    Fin
>>N;
    Fin
>>W;
    
for(int i=0;i<N;i++)
      Fin
>>g[i].h>>g[i].w;
    sort(g,g
+N,mycmpG);
    
    
space[0].x=space[0].y=0;
    
space[0].h=MAX;
    
space[0].w=W;
    
for(int i=0;i<N;i++)
      
space[0].v=false;
    H
=0;
    deep
=0
    bestH 
= MAX;
    spaceNum 
= 1
}   
/*-------------CUT METHOD------------------*/
bool canBeCut(Gadget 
&g,int i,int &TaddSpace)
{
    
int addSpace = 0;    
    
if((space[i].h>=g.h)&&(space[i].w>=g.w)){
        
if(space[i].w>g.w){
            
space[spaceNum].x = space[i].x+g.w;
            
space[spaceNum].y = space[i].y;
            
space[spaceNum].h = g.h;
            
space[spaceNum].w = space[i].w - g.w;
            addSpace
++;
        }
        
if(space[i].h>g.h){
            
space[spaceNum+1].x = space[i].x;    
            
space[spaceNum+1].y = space[i].y+g.h;
            
if(space[i].h==MAX)
                
space[spaceNum+1].h = MAX;
            
else
                
space[spaceNum+1].h = space[i].h - g.h;
            
space[spaceNum+1].w = space[i].w;
            addSpace
++;
        }
        g.x 
= space[i].x;
        g.y 
= space[i].y;
        H 
= max(H,g.y+g.h);
        spaceNum 
+= addSpace;
        TaddSpace 
= addSpace;
        return 
true;
    }
    return 
false;
}
/*-------------THE MAIN METHOD--------------------*/
 void backTrack(
int which)
{   
// if(deep==100000)return;
    
// else deep++;
     sort(
space,space+spaceNum,mycompS);
     
Space   temp[BUFFER];
     
for(int i=0;i<spaceNum;i++)
        temp[i] 
= space[i];    
     
     
if(which==N)
      {
        
if(H<bestH)
        {    bestH 
= H;
            
for(int i = 0;i<N;i++)
              result[i]
=g[i];
           
        }
        return;
      }
     
int addSpace;
     
int Num=spaceNum;     
     
for(int i=0;i<Num;i++)
         
if(space[i].v == false)
          { 
            
int tempH=H;
            
if(canBeCut(g[which],i,addSpace))
            {       
                    
if(H>bestH)//鍓灊 
                    {
                     H 
= tempH;
                     spaceNum 
-= addSpace;
                     continue;
                    }
                    
space[i].v = true;
                    backTrack(which
+1);
                    spaceNum
-=addSpace;
                    
space[i].v = false
                    H 
= tempH;
                    
for(int k=0;k<spaceNum;k++)
                    
space[k] = temp[k];        
             }         
          }
     
}
/*===========GADGET CUT END=============*/ 

/*========NEWBOX CLASS BEGIN============*/
class NEWBOX:
public QWidget
{   
    
public:
        NEWBOX(QWidget 
*parent=0);
    protected:
        void paintEvent(QPaintEvent 
*event); 
    
private:

};
/*NEWBOX METHOD*/
/*-----------------------------------*/
NEWBOX::NEWBOX(QWidget 
*parent):QWidget(parent)
{
     setFixedSize(W
*15,30*15);
     char temp[
5];
     sprintf(temp,
"%d",bestH);
     char title[
40]="H:";
     strcat(title,temp);
     char temp2[
20]=" Spend TIME:";
     char temp3[
5];
     sprintf(temp3,
"%f",(double)(end-start)/CLOCKS_PER_SEC);
     strcat(temp2,temp3);
     strcat(title,temp2);
     setWindowTitle(title);
     setPalette(QPalette(QColor(
250250200)));
     setAutoFillBackground(
true);
}
/*-----------------------------------*/
void NEWBOX::paintEvent(QPaintEvent 
*)
{    QPainter painter(this);
     painter.setPen(Qt::SolidLine);
     painter.setBrush(Qt::blue);
     painter.translate(
0,0);
     
for(int i=0;i<=N;i++)
     painter.drawRect(result[i].x
*15,30*15-result[i].y*15,
     result[i].w
*15,-result[i].h*15);  
}

/*=========NEWBOX CLASS END=============*/

int main(int argc, char *argv[])
{   QApplication app(argc, argv);
    init();
    start
=clock();
    backTrack(
0);
    
end= clock();//TIME END HERE
    NEWBOX newb;
    newb.show();
    return app.exec();

}



]]>
綆楁硶瀹為獙涓夛紙闆嗚綆憋級http://www.shnenglu.com/newplan/archive/2008/06/05/52214.html灞辨硥寮歡灞辨硥寮歡Thu, 05 Jun 2008 01:05:00 GMThttp://www.shnenglu.com/newplan/archive/2008/06/05/52214.htmlhttp://www.shnenglu.com/newplan/comments/52214.htmlhttp://www.shnenglu.com/newplan/archive/2008/06/05/52214.html#Feedback0http://www.shnenglu.com/newplan/comments/commentRss/52214.htmlhttp://www.shnenglu.com/newplan/services/trackbacks/52214.html闃呰鍏ㄦ枃

]]>
acm_GREEDY_鎺掗槦http://www.shnenglu.com/newplan/archive/2008/05/13/49766.html灞辨硥寮歡灞辨硥寮歡Tue, 13 May 2008 15:48:00 GMThttp://www.shnenglu.com/newplan/archive/2008/05/13/49766.htmlhttp://www.shnenglu.com/newplan/comments/49766.htmlhttp://www.shnenglu.com/newplan/archive/2008/05/13/49766.html#Feedback1http://www.shnenglu.com/newplan/comments/commentRss/49766.htmlhttp://www.shnenglu.com/newplan/services/trackbacks/49766.html
/*
 *鏈塏涓漢鎺掗槦鍒癛涓按榫欏ご鍘繪墦姘達紝浠栦滑瑁呮弧姘存《鐨勬椂闂?br> *涓篢1錛孴2錛?#8230;錛孴n涓烘暣鏁頒笖鍚勪笉鐩哥瓑錛屽簲濡備綍瀹夋帓浠栦滑
 *鐨勬墦姘撮『搴忔墠鑳戒嬌浠栦滑鑺辮垂鐨勬椂闂存渶灝戯紵
 *鍒嗘瀽錛氱敱浜庢帓闃熸椂錛岃秺闈犲墠闈㈢殑璁$畻鐨勬鏁拌秺澶氾紝鏄劇劧瓚婂皬
 *鐨勬帓鍦ㄨ秺鍓嶉潰寰楀嚭鐨勭粨鏋滆秺灝忥紙鍙互鐢ㄦ暟瀛︽柟娉曠畝鍗曡瘉鏄庯紝
 *榪欓噷灝變笉鍐嶈禈榪幫級錛屾墍浠ヨ繖閬撻鍙互鐢ㄨ椽蹇冩硶瑙g瓟
 */
/*------------INCLUDES---------------*/
#include 
<cstdlib>
#include 
<iostream>
#include 
<queue>
#include 
<fstream>
/*------------INCLUDES---------------*/

/*---------------STD-----------------*/
using std::ifstream;
using std::queue;
using std::vector;
using std::greater;
using std::priority_queue;
/*---------------STD----------------*/

/*------------GLOBAL VAL------------*/
int  M[5];
/*------------GLOBAL VAL------------*/

/*---------------MAIN---------------*/
int main(int argc, char *argv[])
{   ifstream  Fin;
    Fin.open(
"queue.txt");
    
    priority_queue
<int,vector<int>,greater<vector<int>::value_type> >   iqueue;
    
    
int a;
    
while(Fin>>a)
    {
       iqueue.push(a);
    }
    
    
int flag=0;
    
int i=0;
    
    
while(!iqueue.empty())
    {
      
if(flag==0)
      {M[i]
=iqueue.top();
       iqueue.pop(); 
       i
++;     
       
if(i==5)
       flag
=1;
      }
      
else if(flag==1)
      {
       M[i]
=iqueue.top();
       iqueue.pop(); 
       i
--;
       
if(i==0)
       flag
=0;    
      }
      
    }
    
    system(
"PAUSE");
    return EXIT_SUCCESS;
}
/*---------------MAIN---------------*/



]]>
久久久99精品成人片中文字幕| 久久综合九色综合久99| 丁香五月网久久综合| 久久精品国产精品青草| 久久天天躁狠狠躁夜夜av浪潮 | 久久人做人爽一区二区三区| 亚洲精品美女久久久久99| 狠狠干狠狠久久| 久久久综合香蕉尹人综合网| 午夜人妻久久久久久久久| 久久久久国产一级毛片高清版| 久久人人爽人人爽AV片| 久久天天躁狠狠躁夜夜avapp| 欧美777精品久久久久网| 久久国产劲爆AV内射—百度| 精品免费久久久久国产一区| 国产亚洲美女精品久久久2020| 99久久亚洲综合精品网站| 久久久久久伊人高潮影院| 狠狠色综合网站久久久久久久| 欧美精品久久久久久久自慰| 久久精品亚洲男人的天堂| 国产精品久久久久久| 日产精品久久久久久久| 久久无码高潮喷水| 日韩欧美亚洲国产精品字幕久久久| 99久久精品日本一区二区免费 | 久久发布国产伦子伦精品| 思思久久好好热精品国产| 国产精品成人99久久久久91gav | 996久久国产精品线观看| 亚洲精品无码久久久影院相关影片 | 色婷婷综合久久久久中文一区二区| 久久精品无码一区二区app| 久久91精品国产91久久户| 久久久久99精品成人片欧美| 狠狠综合久久综合88亚洲| 久久无码国产专区精品| 精品久久久中文字幕人妻| 18岁日韩内射颜射午夜久久成人| 亚洲精品tv久久久久久久久久|