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

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

            #

            n為偶數(shù) 構(gòu)造一個(gè) 對(duì)稱的矩陣

            #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++)//輸出部分 ,無(wú)視。。。
                {
                    
            for(j=0;j<n;j++)
                        printf(
            "%d ",a[i][j]);printf("\n");
                }

                
            return 0;
            }
            中間的公式不知道是怎么來(lái)的。。。

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

            樹(shù)狀數(shù)組

            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 閱讀(464) | 評(píng)論 (1)編輯 收藏

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

                 摘要: 今天做得還算順利哈,其他的題都還蠻簡(jiǎn)單的,就是這道G題,yy了半天,寫這個(gè)題的時(shí)候快米有時(shí)間了,最后也沒(méi)出。 后來(lái)聽(tīng)yayamao說(shuō)用搜索,囧了~完全沒(méi)想到,我只會(huì)用DP,呵呵。代碼奉上。 #include<iostream>#include<cmath>#include<cstring>#include<algorithm>using ...  閱讀全文

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

            微機(jī)接口 實(shí)驗(yàn)四 使得0-F循環(huán)再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 閱讀(190) | 評(píng)論 (0)編輯 收藏

            whu 帶花樹(shù)算法 template ,研究下..

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

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

            ZOJ 3316 Game

                 摘要: 淘來(lái)的代碼 慢慢研究下 呵呵。 #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 閱讀(251) | 評(píng)論 (0)編輯 收藏

            JAVA 數(shù)進(jìn)制轉(zhuǎn)換小練

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

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

            JAVA --String類筆試面試題

            字符串對(duì)象是一種特殊的對(duì)象.String類是一個(gè)不可變的類..也就說(shuō),String對(duì)象一旦創(chuàng)建就不允許修改

            String類有一個(gè)對(duì)應(yīng)的String池,也就是 String pool.每一個(gè)內(nèi)容相同的字符串對(duì)象都對(duì)應(yīng)于一個(gè)pool里的對(duì)象.

            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);

            請(qǐng)問(wèn) 前面三條語(yǔ)句分別創(chuàng)建了幾個(gè)對(duì)象,分別是什么.后面的輸出分別是什么

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

            創(chuàng)建的流程是,首先括號(hào)里的"abc"先到String pool里看有沒(méi)"abc"這個(gè)對(duì)象,沒(méi)有則在pool里創(chuàng)建這個(gè)對(duì)象..所以這里就在pool創(chuàng)建了一個(gè)"abc"對(duì)象.然后 通過(guò)new語(yǔ)句又創(chuàng)建了一個(gè)"abc"對(duì)象..而這個(gè)對(duì)象是放在內(nèi)存的堆里. .這里的s指向堆里的對(duì)象.

            (2) String s1 = "abc"; 這條語(yǔ)句,s1當(dāng)然還是引用.沒(méi)啥可說(shuō)的.后面的"abc".其實(shí)就是上面括號(hào)里的"abc".執(zhí)行的是相同的操作.即 在pool里查找有沒(méi)"abc"這個(gè)對(duì)象.沒(méi)有則創(chuàng)建一個(gè)...很顯然,第一條語(yǔ)句在pool里已經(jīng)創(chuàng)建了一個(gè)"abc".所以這條語(yǔ)句沒(méi)有創(chuàng)建對(duì)象,s1指向的是pool中的"abc"

            (3)String s2 = new String("abc"); 這條語(yǔ)句,其實(shí)和第一條是一樣的,但是,因?yàn)榈谝粭l已經(jīng)在pool中創(chuàng)建了"abc"這個(gè)對(duì)象,所以,這條語(yǔ)句創(chuàng)建了一個(gè)對(duì)象.s2指向的是堆里的"abc".注意,雖然內(nèi)容都是"abc",s與s2表示的是不同的對(duì)象

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

            2 第二個(gè)問(wèn)題

            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的幫助文檔來(lái)說(shuō),是返回字符串對(duì)象的規(guī)范化表示形式。通俗一點(diǎn)說(shuō),就是返回對(duì)應(yīng)這個(gè)字符串內(nèi)容的那個(gè)pool里的對(duì)象.這樣說(shuō)也許還看不太明白,那可以拿具體例子來(lái)說(shuō)

            s1.intern().他的執(zhí)行流程是,在pool里去查找s1對(duì)應(yīng)的內(nèi)容(也就是"abc").如果找到,則返回pool里的對(duì)象.如果沒(méi)有(老實(shí)說(shuō),我沒(méi)想到有哪種情況是沒(méi)有的),則在Pool創(chuàng)建這個(gè)對(duì)象,并返回...

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

            3第三個(gè)問(wèn)題

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

            求輸出的結(jié)果

            解答 true false

            首先,上面已經(jīng)說(shuō)明了,hello hel lo這三個(gè)都是指向pool中的對(duì)象..

            現(xiàn)在我們考慮"hel" + "lo" 按照內(nèi)容來(lái)說(shuō),兩個(gè)相加也就是"hello".這個(gè)時(shí)候,這個(gè)會(huì)返回pool中的"hello"對(duì)象.所以,hello == "hel" + "lo" 返回的是true .

            而"hel" + lo 雖然內(nèi)容也是"hello",但是它將在堆里面生成一個(gè)"hello"對(duì)象,并返回這個(gè)對(duì)象...所以這里的結(jié)果是false

            總結(jié)一下就是,如果加號(hào)兩邊的是字面值(字面值就是直接在""里寫的值,比如上面的"hel"與"lo"),那么將在pool里查找有沒(méi)對(duì)應(yīng)內(nèi)容的對(duì)象(這里的內(nèi)容就是"hello"),并返回pool里的對(duì)象.這和hello是一樣的....

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


            轉(zhuǎn)自:http://jingbo2759.blog.163.com/blog/static/98375315200971731522144/

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

            所有數(shù)位相加

             

            /*==================================================*\
            | 所有數(shù)位相加
            | 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的區(qū)間中么 特殊處理下 0-8 即可。。。

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

            POJ 3742 Equivalent Polynomial java

            開(kāi)始自己寫個(gè)C(n,m) RE... 后來(lái)改成遞推 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 閱讀(1030) | 評(píng)論 (1)編輯 收藏

            僅列出標(biāo)題
            共42頁(yè): First 12 13 14 15 16 17 18 19 20 Last 
            性欧美大战久久久久久久| 久久精品国产色蜜蜜麻豆| 久久精品成人免费看| 99久久国产免费福利| 久久亚洲av无码精品浪潮| 久久天天躁狠狠躁夜夜2020一| 久久久久亚洲av综合波多野结衣| 久久永久免费人妻精品下载| 国产精品一久久香蕉国产线看| 狠狠综合久久综合中文88| 久久中文字幕精品| 久久精品成人免费网站| 久久人人爽人人人人爽AV| 久久国产一区二区| 亚洲精品tv久久久久久久久| 青青草原1769久久免费播放| 久久久亚洲裙底偷窥综合 | 久久无码中文字幕东京热| 久久精品国产亚洲av水果派| 久久噜噜久久久精品66| 久久精品国产亚洲综合色| 日韩人妻无码一区二区三区久久99| 精品午夜久久福利大片| 色狠狠久久AV五月综合| 久久亚洲高清综合| 成人午夜精品久久久久久久小说| 久久夜色精品国产噜噜亚洲AV| 午夜精品久久久内射近拍高清| 欧美综合天天夜夜久久| 国产成人久久精品激情| 亚洲精品白浆高清久久久久久 | 久久亚洲中文字幕精品一区| 久久久久久久久久免免费精品 | 久久免费线看线看| 久久精品国产亚洲AV高清热| 亚洲午夜久久久久妓女影院 | 久久久久国产日韩精品网站| 青青国产成人久久91网| 久久久久一区二区三区| 一本一道久久精品综合| 国产亚洲精午夜久久久久久|