青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

newplan

阿基米德在洗澡時發現浮力原理,高興得來不及穿上褲子,跑到街上大喊:Eureka(我找到了)。
posts - 39, comments - 26, trackbacks - 0, articles - 4
  C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

2008年12月21日

     摘要: import java.io.BufferedReader;import java.io.File;import java.io.FileWriter;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import&...  閱讀全文

posted @ 2008-12-21 20:38 山泉彎延 閱讀(3405) | 評論 (0)編輯 收藏

2008年12月13日

import 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();  
    
    }

    
    
}

posted @ 2008-12-13 19:04 山泉彎延 閱讀(753) | 評論 (0)編輯 收藏

2008年10月16日


#include 
<iostream>
#include 
<String>
using namespace std;
class ia{
      
public:
      ia(
string a){this->a=a;}
      
~ia(){cout<<"~"<<a<<endl;getchar();}
      
private:
              
string a;
      };
int main()
{
    auto_ptr
<ia> ap(new ia("newplan"));
    ia 
*bp = new ia("zhaoziming");
    
return 1;
}

posted @ 2008-10-16 20:12 山泉彎延 閱讀(881) | 評論 (0)編輯 收藏

2008年9月17日

/*
bash myshell.sh
*/
echo "doing jobs...."
yacc -d  b3.y
lex   b3.l
cc lex.yy.c  y.tab.c -o b3
echo "jobs end."

posted @ 2008-09-17 00:05 山泉彎延 閱讀(514) | 評論 (1)編輯 收藏

/*
編譯原理實驗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;
}

posted @ 2008-09-17 00:01 山泉彎延 閱讀(388) | 評論 (0)編輯 收藏

/*
編譯原理實驗三實驗代碼
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;
}

posted @ 2008-09-17 00:00 山泉彎延 閱讀(435) | 評論 (0)編輯 收藏

2008年6月24日

function[]=iqr()
% 實驗名稱:方陣的QR分解
% 實驗描述:先將方陣化為上海申博格陣,再用QR分解法求上海申博格陣的特征值,則所得到的特征值也是方陣的特征值
% 作者:newplan
% 實驗完成日期:6月10號
%下面的A為測試三階的方陣
A
=[5,-3,2;6,-4,4;4,-4,5]
%下面的A為測試四階的方陣
%A 
= [1 2 1 2;2 2 -1 1;1 -1 1 1;2 1 1 1]
%通過調用malab的自帶的函數求得A的所有特征值和特征向量
%特征值保存在v中,特征向量保存的在d中,將其打印出來和我們的算法算出來的特征值進行對比
[v,d]
=eig(A)
%求出行和列的大小
msize
=size(A);
%取得矩陣的列數,其實行數和列數都為n
n
=msize(1);
%生成n階單位陣
Q
=eye(n);
%用household的方法求矩陣A的上海森伯格陣
for i=1:n-2%從第一列開始到倒數第三列 
    %求出每一列的最大值
    d
=max(abs(A(i+1:n,i)));
    %規范化
    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矩陣根據課本316P例題三 
    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為判斷QR法是否繼續進行的標志位
flag 
=1;
while flag==1
flag 
=0 ;
=A;
= eye(n,n);
%按照QR分解法求出cos,
sin 然后計算V,最終得到R和Q
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
%用R
*Q的結果去替換A
=R*Q;
%下面這個循環檢測A的精度時候足夠,去看A的次對角線各個元素的絕對值是否小于誤差限制
for w =2:n
     
if abs(A(w,w-1))>error
     flag 
= 1 ;
     break;%若有其中一個元素的絕對值還是大于誤差限制則還要繼續進行QR分解
    
end   
end
%判斷的過程完畢
end
%把A打印出來
A



posted @ 2008-06-24 10:52 山泉彎延 閱讀(2498) | 評論 (0)編輯 收藏

2008年6月10日

/*
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();

}

posted @ 2008-06-10 21:47 山泉彎延 閱讀(387) | 評論 (0)編輯 收藏

2008年6月5日

     摘要: /*08.6.2*//*------------------INCLUDES BEGIN---------------*/#include <cstdlib>#include <iostream>#include <fstream>#include <string>#include <...  閱讀全文

posted @ 2008-06-05 09:05 山泉彎延 閱讀(569) | 評論 (0)編輯 收藏

2008年5月13日

/*
 *有N個人排隊到R個水龍頭去打水,他們裝滿水桶的時間
 *為T1,T2,…,Tn為整數且各不相等,應如何安排他們
 *的打水順序才能使他們花費的時間最少?
 *分析:由于排隊時,越靠前面的計算的次數越多,顯然越小
 *的排在越前面得出的結果越小(可以用數學方法簡單證明,
 *這里就不再贅述),所以這道題可以用貪心法解答
 */
/*------------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---------------*/

posted @ 2008-05-13 23:48 山泉彎延 閱讀(623) | 評論 (1)編輯 收藏

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            欧美一区1区三区3区公司| 麻豆亚洲精品| 欧美日韩亚洲视频| 亚洲最新视频在线| 亚洲经典在线看| 欧美日韩在线视频观看| 亚洲影视在线播放| 小黄鸭精品密入口导航| 精品电影在线观看| 亚洲精品你懂的| 欧美精品二区| 欧美一区二区精品| 久久久久久久综合| 99视频一区二区三区| 亚洲国产精品一区二区尤物区| 亚洲欧洲综合| 国产拍揄自揄精品视频麻豆| 久久久久国内| 欧美日韩精品国产| 久久久久久伊人| 欧美日韩成人激情| 久久全国免费视频| 欧美色欧美亚洲另类二区| 久久大香伊蕉在人线观看热2| 毛片精品免费在线观看| 午夜精品久久久久| 欧美成人a视频| 久久国产成人| 欧美日韩在线免费观看| 久久一日本道色综合久久| 欧美日韩一区二区三区免费看| 久久久久国产精品一区三寸| 欧美激情综合| 欧美国产日韩视频| 国产精品自在在线| 亚洲国产精品久久久| 国产日韩av高清| 99亚洲一区二区| 亚洲精品123区| 午夜欧美大片免费观看 | 亚洲二区在线视频| 国产欧美91| 亚洲精品一区二| 亚洲精品在线二区| 久久伊人精品天天| 亚洲精选成人| 欧美在线观看一区| 欧美视频在线不卡| 欧美精品九九| 国产无一区二区| 最新成人在线| 日韩午夜三级在线| 黄色av成人| 欧美日韩精品二区| 日韩视频中午一区| 99精品国产一区二区青青牛奶| 欧美一区成人| 欧美伊久线香蕉线新在线| 欧美三级电影精品| 日韩视频在线观看一区二区| 亚洲国产另类久久久精品极度| 午夜在线一区二区| 亚洲尤物在线视频观看| 亚洲性视频网站| 欧美91福利在线观看| 国产精品日本| 亚洲图片欧美日产| 亚洲综合精品自拍| 国产精品每日更新| 亚洲一区在线免费| 欧美在线视频全部完| 国产精品一区二区三区久久久| 亚洲一区不卡| 亚洲欧美综合另类中字| 国产精品一区二区三区观看| 亚洲综合日韩在线| 久久精品国产久精国产思思| 国产精品美女主播在线观看纯欲| 亚洲自拍三区| 久久在线免费视频| 亚洲高清精品中出| 欧美精品在线网站| 亚洲无线视频| 久久久一区二区| 亚洲精品影院在线观看| 欧美午夜激情视频| 香蕉av福利精品导航| 免费欧美网站| 亚洲一区二区伦理| 国产一区二区电影在线观看| 欧美a级大片| 亚洲午夜精品网| 亚洲欧美日韩国产一区二区三区| 中文日韩电影网站| 亚洲精品国产系列| 亚洲图片欧洲图片av| 国产精品中文在线| 久久美女性网| 99re66热这里只有精品3直播| 亚洲免费一在线| 136国产福利精品导航| 欧美三区不卡| 久久久另类综合| 一区二区三区久久| 久久在线视频在线| 亚洲在线视频免费观看| 在线观看亚洲精品| 国产精品美女主播在线观看纯欲| 久久这里只有| 欧美一区2区视频在线观看| 亚洲欧洲精品一区二区三区波多野1战4| 亚洲午夜久久久久久尤物| 一区二区在线视频观看| 欧美午夜不卡在线观看免费 | 小辣椒精品导航| 国产亚洲欧洲| 久久女同精品一区二区| 一本不卡影院| 亚洲高清免费在线| 国产一区日韩一区| 国产精品久久久久一区| 女女同性精品视频| 久久精品在线免费观看| 亚洲一区二区视频在线| 亚洲三级免费| 亚洲高清网站| 欧美激情二区三区| 巨胸喷奶水www久久久免费动漫| 午夜精品久久久久久久99热浪潮| 亚洲精品无人区| 亚洲精品国精品久久99热一| 狠狠干综合网| 激情国产一区二区| 黄色精品网站| 激情视频亚洲| 伊人精品视频| 亚洲第一精品福利| 在线精品视频免费观看 | 久久免费视频网站| 久久激情一区| 久久久久久久久久码影片| 欧美专区在线观看一区| 久久精品论坛| 久久久夜精品| 久久综合精品国产一区二区三区| 久久精品系列| 麻豆精品视频| 欧美精品久久99| 欧美日本韩国| 国产精品一区二区三区乱码| 国产乱肥老妇国产一区二 | 欧美韩日精品| 欧美精品尤物在线| 99re6这里只有精品视频在线观看| 欧美一级片在线播放| 亚洲欧美综合精品久久成人| 亚洲欧美久久| 欧美制服丝袜| 六月婷婷久久| 亚洲激情网站| 一本大道久久a久久综合婷婷| 中文亚洲视频在线| 欧美在线视频观看| 另类天堂av| 欧美色另类天堂2015| 国产欧美日韩精品丝袜高跟鞋| 国产主播一区二区三区四区| 亚洲电影观看| 亚洲一区日韩在线| 性久久久久久久| 美国成人直播| 国产乱码精品一区二区三| 亚洲高清在线视频| 在线视频中文亚洲| 久久综合五月| aa级大片欧美三级| 欧美在线免费| 欧美日韩在线综合| 一区二区在线免费观看| 亚洲午夜精品在线| 欧美aⅴ一区二区三区视频| 日韩一区二区高清| 久久久久久久综合色一本| 欧美日韩亚洲视频一区| 在线观看欧美黄色| 午夜精品网站| 亚洲国产专区| 欧美在线免费视频| 欧美日韩成人一区二区| 精品91视频| 羞羞答答国产精品www一本| 亚洲国产精品第一区二区三区 | 中日韩高清电影网| 蜜桃av一区二区三区| 亚洲欧美日韩成人高清在线一区| 欧美福利视频在线| 永久久久久久| 久久久夜夜夜| 亚洲男女毛片无遮挡| 欧美日韩亚洲一区二区三区在线观看|