• <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>

            The Fourth Dimension Space

            枯葉北風寒,忽然年以殘,念往昔,語默心酸。二十光陰無一物,韶光賤,寐難安; 不畏形影單,道途阻且慢,哪曲折,如渡飛湍。斬浪劈波酬壯志,同把酒,共言歡! -如夢令

            #

            n為偶數 構造一個 對稱的矩陣

            #include<cstdio> 
            int n,a[1000][1000],i,j; 
            int main()

                scanf(
            "%d",&n); 
                
            for(i=0;i<n-1;i++)
                    
            for(j=0;j<n-1;j++)
                        a[i][j]
            =(i+j)%(n-1+1
                
            for(i=0;i<n;i++)
                    a[i][n
            -1]=a[n-1][i]=a[i][i],a[i][i]=0
                
                
            for(i=0;i<n;i++)//輸出部分 ,無視。。。
                {
                    
            for(j=0;j<n;j++)
                        printf(
            "%d ",a[i][j]);printf("\n");
                }

                
            return 0;
            }
            中間的公式不知道是怎么來的。。。

            posted @ 2010-04-30 14:03 abilitytao 閱讀(186) | 評論 (0)編輯 收藏

            樹狀數組

            int getsum(int t)
                
            int sum = 0
                
            while(t > 0)
                    sum 
            = Max(s[t],sum); 
                    t 
            -= (t&(-t)); 
                }
             
                
            return sum; 
            }
             

            void add(int t,int v)
                
            while(t <= size)
                    s[t] 
            = Max(v,s[t]); 
                    t 
            += (t&(-t)); 
                }
             
            }
             

            posted @ 2010-04-30 10:58 abilitytao 閱讀(459) | 評論 (1)編輯 收藏

            福大校賽 G題 小小的悲劇哈

                 摘要: 今天做得還算順利哈,其他的題都還蠻簡單的,就是這道G題,yy了半天,寫這個題的時候快米有時間了,最后也沒出。 后來聽yayamao說用搜索,囧了~完全沒想到,我只會用DP,呵呵。代碼奉上。 #include<iostream>#include<cmath>#include<cstring>#include<algorithm>using ...  閱讀全文

            posted @ 2010-04-25 17:38 abilitytao 閱讀(1023) | 評論 (0)編輯 收藏

            微機接口 實驗四 使得0-F循環再LED上顯示

            .model small
            .stack
            .data
            LEDtb db 0c0h,0f9h,0a4h,0b0h,99h,92h,82h,0f8h,80h,90h,88h,83h,0c6h,0a1h,86h,8eh
            portA dw 0e400h
            portB dw 0e401h
            portCro dw 0e403h
            .code

            time proc near
                 push dx
                 push bx
                 mov dx,5fffh
            bahar:    mov bx,5fffh
            fuuy:  dec bx
                 jnz fuuy
                 dec dx
                 jnz bahar
                 pop bx
                 pop dx
                 ret
                 time endp


            pckey proc near
                  push dx
                  push ax
                  mov ah,
            6
                  mov dl,0ffh
                  
            int 21h
                  je  p1
                  mov ax,4c00h
                  
            int 21h
            p1:   pop ax
                  pop dx
                  ret
                  pckey endp

            start:
            init:
                mov ax,@data
                mov ds,ax
                lea si,LEDtb
                mov dx,portCro
                mov al,80h
                
            out dx,al
                mov cl,0f7h
                mov bx,00h
            s1:
                mov dx,portA
                mov al,[si
            +bx]
                
            out dx,al
                mov dx,portB
                mov al,cl
                
            out dx,al
                inc bx

                call time
                call pckey
                cmp bx,0fh
                jg s2
            next:
                cmp cl,0feh
                jz s3
            next2:
                ror cl,
            1
                jmp s1


            s2:
                mov bx,00h
                jmp next
            s3:
                mov cl,0efh
                jmp next2
             end start

            posted @ 2010-04-24 17:58 abilitytao 閱讀(188) | 評論 (0)編輯 收藏

            whu 帶花樹算法 template ,研究下..

                 摘要: struct Graph {    int n, match[maxn];    bool adj[maxn][maxn];    void clear() {    &...  閱讀全文

            posted @ 2010-04-24 16:43 abilitytao 閱讀(864) | 評論 (2)編輯 收藏

            ZOJ 3316 Game

                 摘要: 淘來的代碼 慢慢研究下 呵呵。 #include<iostream>using namespace std;#define maxn 405#define maxm 330000struct Edge{    int v,next;}E[maxm];int ...  閱讀全文

            posted @ 2010-04-24 14:54 abilitytao 閱讀(247) | 評論 (0)編輯 收藏

            JAVA 數進制轉換小練

                 摘要: 真是JAVA在手 萬事無憂啊。。。POJ 2798 二進制到十六進制轉換 import java.util.*;import java.math.*;/** *//** * * @author weitao */public class Main {   &...  閱讀全文

            posted @ 2010-04-24 00:57 abilitytao 閱讀(447) | 評論 (0)編輯 收藏

            JAVA --String類筆試面試題

            字符串對象是一種特殊的對象.String類是一個不可變的類..也就說,String對象一旦創建就不允許修改

            String類有一個對應的String池,也就是 String pool.每一個內容相同的字符串對象都對應于一個pool里的對象.

            1 看下面一段代碼.

            String s = new String("abc");
              String s1 = "abc";
              String s2 = new String("abc");
              
              System.out.println(s == s1);
              System.out.println(s == s2);
              System.out.println(s1 == s2);

            請問 前面三條語句分別創建了幾個對象,分別是什么.后面的輸出分別是什么

            (1)String s = new String("abc"); 這句,創建了兩個對象..其內容都是"abc".注意,s不是對象,只是引用.只有new生成的才是對象.

            創建的流程是,首先括號里的"abc"先到String pool里看有沒"abc"這個對象,沒有則在pool里創建這個對象..所以這里就在pool創建了一個"abc"對象.然后 通過new語句又創建了一個"abc"對象..而這個對象是放在內存的堆里. .這里的s指向堆里的對象.

            (2) String s1 = "abc"; 這條語句,s1當然還是引用.沒啥可說的.后面的"abc".其實就是上面括號里的"abc".執行的是相同的操作.即 在pool里查找有沒"abc"這個對象.沒有則創建一個...很顯然,第一條語句在pool里已經創建了一個"abc".所以這條語句沒有創建對象,s1指向的是pool中的"abc"

            (3)String s2 = new String("abc"); 這條語句,其實和第一條是一樣的,但是,因為第一條已經在pool中創建了"abc"這個對象,所以,這條語句創建了一個對象.s2指向的是堆里的"abc".注意,雖然內容都是"abc",s與s2表示的是不同的對象

            (4)接下來就很好說了.下面的三個==判斷.(注意,==永遠是判斷內存地址是否相等) s與s1,一個指向堆里的對象,一個指向pool里的.很明顯是不同的對象.s與s2.上面說了,雖然都是指向堆里的對象,內容也是"abc",但是也不是相同的對象.s1與s2.一個指向pool,一個指向堆.也不是相同的對象.所以三個都返回false.

            2 第二個問題

            String s = new String("abc");
              String s1 = "abc";
              String s2 = new String("abc");
              
              System.out.println(s == s1.intern());
              System.out.println(s == s2.intern());
              System.out.println(s1 == s2.intern());

            求最后輸出是什么

            解答.最后的答案是 false false true

            intern()方法.按照jdk的幫助文檔來說,是返回字符串對象的規范化表示形式。通俗一點說,就是返回對應這個字符串內容的那個pool里的對象.這樣說也許還看不太明白,那可以拿具體例子來說

            s1.intern().他的執行流程是,在pool里去查找s1對應的內容(也就是"abc").如果找到,則返回pool里的對象.如果沒有(老實說,我沒想到有哪種情況是沒有的),則在Pool創建這個對象,并返回...

            這樣就很容易理解了.s1.intern返回的是pool里的"abc"對象.與s這個堆里的對象肯定不同,返回false.同理,s與s2.intern()也肯定不同,返回false.第三個,s1與s2.intern().其中s2.intern()返回的是pool中的"abc"對象,而s1也是指向pool中的"abc"對象.所以返回的是true:

            3第三個問題

            String hello = "hello";
              String hel = "hel";
              String lo = "lo";
              
              System.out.println(hello == "hel" + "lo");
              System.out.println(hello == "hel" + lo);

            求輸出的結果

            解答 true false

            首先,上面已經說明了,hello hel lo這三個都是指向pool中的對象..

            現在我們考慮"hel" + "lo" 按照內容來說,兩個相加也就是"hello".這個時候,這個會返回pool中的"hello"對象.所以,hello == "hel" + "lo" 返回的是true .

            而"hel" + lo 雖然內容也是"hello",但是它將在堆里面生成一個"hello"對象,并返回這個對象...所以這里的結果是false

            總結一下就是,如果加號兩邊的是字面值(字面值就是直接在""里寫的值,比如上面的"hel"與"lo"),那么將在pool里查找有沒對應內容的對象(這里的內容就是"hello"),并返回pool里的對象.這和hello是一樣的....

            如果加號兩邊不滿足上面的條件(比如,兩邊的值是引用值或者堆里的字符串對象).那么將不會再pool里查找"hello",而是直接在堆里生成一個新的對象...


            轉自:http://jingbo2759.blog.163.com/blog/static/98375315200971731522144/

            posted @ 2010-04-23 22:06 abilitytao 閱讀(525) | 評論 (0)編輯 收藏

            所有數位相加

             

            /*==================================================*\
            | 所有數位相加
            | dig(x) := x if 0 <= x <= 9
            | dig(x) := dig(sum of digits of x) if x >= 10
            \*==================================================
            */

            方法一:模擬
            int dig(int x){
            if( x < 10 ) return x;
            int sum = 0;
            while( x ) { sum += x%10; x /= 10; }
            return dig(sum);
            }

            方法二:公式 【不太明白
            int dig(int x)return (x+8)%9+1; }//暈 不是很容易懂么 不是總在mod 9的區間中么 特殊處理下 0-8 即可。。。

            posted @ 2010-04-23 17:59 abilitytao 閱讀(450) | 評論 (1)編輯 收藏

            POJ 3742 Equivalent Polynomial java

            開始自己寫個C(n,m) RE... 后來改成遞推 AC...
            另外就是while里面一定要用while(cin.hasNext)???不能用cin.hasNextInt()???用了就RE...丫的。。。

            import java.math.BigInteger;
            import java.io.*;
            import java.util.*;

            public class Main {
                
            static int n;
                
            static BigInteger t=new BigInteger("1");
                
            static BigInteger c[][] = new BigInteger [210][210];

                
            /*
                static BigInteger C(int n,int m)
                {
                    if(m==0||m==n)
                        return BigInteger.ONE;
                    BigInteger res=new BigInteger("1");
                    int i;
                    for(i=n;i>=n-m+1;i--)
                        res=res.multiply(BigInteger.valueOf(i));
                    for(i=m;i>=1;i--)
                        res=res.divide(BigInteger.valueOf(i));
                    return res;
                }
                
            */


                
            static int a[]=new int[202];
                
            static BigInteger ans[]=new BigInteger [202];

                
            /**
                 * 
            @param args the command line arguments
                 
            */

                
            public static void main(String[] args) {
                    
            for(int i=0;i<=200;i++) c[i][0]=c[i][i]=BigInteger.ONE;
                    
            for(int i=2;i<=200;i++)
                    
            {
                        
            for(int j=1;j<i;j++)
                        
            {
                            c[i][j]
            =c[i-1][j].add(c[i-1][j-1]);
                        }

                    }

                    Scanner cin 
            = new Scanner (new BufferedInputStream(System.in));
                    
            while(cin.hasNext())
                    
            {

                        n
            =cin.nextInt();
                        t
            =cin.nextBigInteger();
                        
            int i,j;
                        
            for(i=0;i<=n;i++)
                            a[i]
            =cin.nextInt();
                        
            for(i=0;i<=n;i++)
                            ans[i]
            =BigInteger.ZERO;

                        
            for(i=0;i<=n;i++)
                            
            for(j=i;j<=n;j++)
                               
            if(j-i<i)
                                ans[i]
            =ans[i].add(c[j][j-i].multiply(t.pow(j-i)).multiply(BigInteger.valueOf(a[j])));
                               
            else
                                ans[i]
            =ans[i].add(c[j][i].multiply(t.pow(j-i)).multiply(BigInteger.valueOf(a[j])));
                        
            for(i=0;i<n;i++)
                        
            {
                            System.out.print(ans[i]);
                            System.out.print(
            " ");
                        }

                         System.out.println(ans[n]);

                        
            /*
                        String res=new String ("");
                        for(i=0;i<n;i++)
                        {
                            res+=ans[i].toString();
                            res+=" ";
                        }
                        res+=ans[n].toString();
                        System.out.print(res);
                        System.out.println();
                         * 
            */


                   }

             
                }

            }

            posted @ 2010-04-23 12:57 abilitytao 閱讀(1026) | 評論 (1)編輯 收藏

            僅列出標題
            共42頁: First 12 13 14 15 16 17 18 19 20 Last 
            久久午夜综合久久| 久久er热视频在这里精品| 亚洲午夜福利精品久久| 国产成人精品综合久久久| 久久青青草原精品国产| 国内精品久久久久影院网站| 久久精品国产欧美日韩99热| 久久久久免费看成人影片| AA级片免费看视频久久| 亚洲欧美日韩中文久久| 99久久精品这里只有精品| 无码人妻久久一区二区三区蜜桃| 亚洲AV成人无码久久精品老人| 久久九九亚洲精品| 亚洲成色www久久网站夜月| 国产精品无码久久综合网| 亚洲色欲久久久综合网东京热| 久久久精品一区二区三区| 久久强奷乱码老熟女网站| 久久国产一片免费观看| 久久久久久久97| 久久99久久99精品免视看动漫 | 久久人人爽人人爽人人片av麻烦| 久久久久夜夜夜精品国产| 久久精品国产2020| 欧美成a人片免费看久久| 国产激情久久久久影院老熟女| 热re99久久精品国99热| 欧美精品国产综合久久| 人妻中文久久久久| 四虎国产精品成人免费久久| 久久er国产精品免费观看8| 国产午夜精品理论片久久影视 | 久久亚洲精品无码播放| 狠狠精品久久久无码中文字幕| 国产精品一久久香蕉产线看| 久久婷婷国产综合精品| 久久一日本道色综合久久| 狠狠88综合久久久久综合网 | 久久人人爽人人爽人人AV| 日韩精品久久久久久免费|