Icyblade's profile临风阁BlogListsGuestbookMore Tools Help

Blog


    November 14

    我的 VIM 配置文件( _vimrc )

    1. set ai
    2. set autochdir
    3. set autoindent
    4. set awa
    5. set cindent
    6. set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s
    7. set expandtab
    8. set fileencodings=ucs-bom,utf8,GB18030,Big5,latin1
    9. set history=50
    10. set hlsearch
    11. set ignorecase
    12. set incsearch
    13. set laststatus=2
    14. set nobackup
    15. set nocompatible
    16. set number
    17. set paste
    18. set ruler
    19. set shiftwidth=4
    20. set showcmd
    21. set showmatch
    22. set smartcase
    23. set smartindent
    24. set softtabstop=4
    25. set statusline=%F%m%r,\ %Y,\ %{&fileformat}\ \ \ ASCII=\%b,HEX=\0x\%B\ \ \ %l,%c%V\ \ %p%%
    26. set tabstop=4

    27. :map <F5> :tabprevious<CR>
    28. :map <F6> :tabnew<CR>
    29. :map <F7> :tabnext<CR>
    30. :map <F2> :!g++ % -o %<<CR>
    31. :map <F3> :!%<<CR>
    32. :map <F4> :!clear<CR>
    33. :imap <F5> <ESC>:tabprevious<CR>i
    34. :imap <F6> <ESC>:tabnew<CR>i
    35. :imap <F7> <ESC>:tabnext<CR>i
    36. :imap <F2> <ESC>:!g++ % -o %<<CR>
    37. :imap <F3> <ESC>:!%<<CR>
    38. :imap <F4> <ESC>:!clear<CR>

    39. runtime! debian.vim
    40. syntax enable
    41. if filereadable("/etc/vim/vimrc.local")
    42.   source /etc/vim/vimrc.local
    43. endif

    44. if &term=="xterm"
    45. set t_Co=8
    46. set t_Sb=^[[4%dm
    47. set t_Sf=^[[3%dm
    48. endif
    November 07

    ACM 2009 华中科技大学预选赛

    A:A Very Easy Problem!

    Description

    In A speech contest, when a contestant finishes his speech, the judges will then grade his performance. The staffs remove the highest grade and the lowest grade and compute the average of the rest as the contestant’s final grade. This is an easy problem because usually there are only several judges.

    Let’s consider a generalized form of the problem above. Given n positive integers, remove the greatest n1 ones and the least n2 ones, and compute the average of the rest.

    Input

    The input consists of several test cases. Each test case consists two lines. The first line contains three integers n and n1, n2 (1<=n1, n2<=10,n1+n2<n<=5000) separate by a single space. The second line contains n non-descending positive integers ai (1<=a1<=a2…<=an-1<=an<=10^3 for all i s.t. 1<=i<=n) separated by a single space. The last test case is followed by three zeroes.

    Output

    For each test case, output the average rounded to six digits after decimal point in a separate line.

    Sample Input

    5 1 2

    1 2 3 4 5

    10 4 2

    155 220 485 531 582 652 843 902 926 999

    0 0 0

    Sample Output

    3.500000

    562.500000

    Hint

    You can use printf(“%.6lf”,ans) in c/c++ or writeln(ans:0:6) in pascal to output the answer.

    B:Yeehaa!

    Description

    Background
    George B. wants to be more than just a good American. He wants to make his daddy proud and become a western hero. You know, like John Wayne.
    But sneaky as he is, he wants a special revolver that will allow him to shoot more often than just the usual six times. This way he can fool and kill the enemy easily (at least that's what he thinks).
    Problem
    George has kidnapped ... uh, I mean ... "invited" you and will only let you go if you help him with the math. The piece of the revolver that contains the bullets looks like this (examples for 6 and 17 bullets):

    2

    There is a large circle with radius R and n little circles with radius r that are placed inside on the border of the large circle. George wants his bullets to be as large as possible, so there should be no space between the circles. George will decide how large the whole revolver will be and how many bullets it shall contain.Your job is, given R and n, to compute r.

    Input

    The first line contains the number of scenarios. For each scenario follows a line containing a real number R and an integer n, with 1 <= R <= 100 and 2 <= n <= 100.

    Output

    The output for every scenario begins with a line containing "Scenario #i:", where i is the number of the scenario starting at 1. Then print the value for r, rounded to three decimal places. Terminate the output for the scenario with a blank line.

    Sample Input

    4

    4.0 6

    4.0 17

    3.14159 100

    42 2

    Sample Output

    Scenario #1:

    1.333

    Scenario #2:

    0.621

    Scenario #3:

    0.096

    Scenario #4:

    21.000

    C:An Easy Problem!

    Description

    Have you heard the fact "The base of every normal number system is 10" ? Of course, I am not talking about number systems like Stern Brockot Number System. This problem has nothing to do with this fact but may have some similarity.
    You will be given an N based integer number R and you are given the guaranty that R is divisible by (N-1). You will have to print the smallest possible value for N. The range for N is 2 <= N <= 62 and the digit symbols for 62 based number is (0..9 and A..Z and a..z). Similarly, the digit symbols for 61 based number system is (0..9 and A..Z and a..y) and so on.

    Input

    Each line in the input will contain an integer (as defined in mathematics) number of any integer base (2..62). You will have to determine what is the smallest possible base of that number for the given conditions. No invalid number will be given as input. There are at most 10000 characters in a single line.

    Output

    If number with such condition is not possible output the line "such number is impossible!" For each line of input there will be only a single line of output. The output will always be in decimal number system.

    Sample Input

    3

    5

    A

    Sample Output

    4

    6

    11

    D:Bad Cowtractors

    Description

    Bessie has been hired to build a cheap internet network among Farmer John's N (2 <= N <= 1,000) barns that are conveniently numbered 1..N. FJ has already done some surveying, and found M (1 <= M <= 20,000) possible connection routes between pairs of barns. Each possible connection route has an associated cost C (1 <= C <= 100,000). Farmer John wants to spend the least amount on connecting the network; he doesn't even want to pay Bessie.
    Realizing Farmer John will not pay her, Bessie decides to do the worst job possible. She must decide on a set of connections to install so that (i) the total cost of these connections is as large as possible, (ii) all the barns are connected together (so that it is possible to reach any barn from any other barn via a path of installed connections), and (iii) so that there are no cycles among the connections (which Farmer John would easily be able to detect). Conditions (ii) and (iii) ensure that the final set of connections will look like a "tree".

    Input

    The input contains several test cases.

    The first line of each case is two space-separated integers:N and M.

    Lines 2..M+1: Each line contains three space-separated integers A, B, and C that describe a connection route between barns A and B of cost C.

    The end of input is indicated by a line containing n=0 and m=0.

    Output

    For each case a single integer, containing the price of the most expensive tree connecting all the barns. If it is not possible to connect all the barns, output -1.

    Sample Input

    5 8

    1 2 3

    1 3 7

    2 3 10

    2 4 4

    2 5 8

    3 4 6

    3 5 2

    4 5 17

    Sample Output

    42

    Hint

    OUTPUT DETAILS:
    The most expensive tree has cost 17 + 8 + 10 + 7 = 42. It uses the following connections: 4 to 5, 2 to 5, 2 to 3, and 1 to 3.

    E:How many Fibs?

    Description

    Recall the definition of the Fibonacci numbers:

    f1 := 1

    f2 := 2

    fn := fn-1 + fn-2 (n>=3)

    Given two numbers a and b, calculate how many Fibonacci numbers are in the range [a,b].

    Input

    The input contains several test cases. Each test case consists of two non-negative integer numbers a and b. Input is terminated by a=b=0. Otherwise, a<=b<=10100. The numbers a and b are given with no superfluous leading zeros.

    Output

    For each test case output on a single line the number of Fibonacci numbers fi with a<=fi<=b.

    Sample Input

    10 100

    1234567890 9876543210

    0 0

    Sample Output

    5

    4

    F:Lake Counting

    Description

    Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains either water ('W') or dry land ('.'). Farmer John would like to figure out how many ponds have formed in his field. A pond is a connected set of squares with water in them, where a square is considered adjacent to all eight of its neighbors.

    Given a diagram of Farmer John's field, determine how many ponds he has.

    Input

    The input consists of several test cases.

    The first line of each case :Two space-separated integers: N and M

    The second line to N+1th of each case : M characters per line representing one row of Farmer John's field. Each character is either 'W' or '.'. The characters do not have spaces between them.

    A line containing 0 0 follows the last case.(don’t process)

    Output

    For each case output a line contains the number of ponds.

    Sample Input

    1

    Sample Output

    2

    3

    G:Cow BowlingTime

    Description

    The cows don't use actual bowling balls when they go bowling. They each take a number (in the range 0..99), though, and line up in a standard bowling-pin-like triangle like this:

    7

    3 8

    8 1 0

    2 7 4 4

    4 5 2 6 5

    Then the other cows traverse the triangle starting from its tip and moving "down" to one of the two diagonally adjacent cows until the "bottom" row is reached. The cow's score is the sum of the numbers of the cows visited along the way. The cow with the highest score wins that frame.

    Given a triangle with N (1 <= N <= 350) rows, determine the highest possible sum achievable.

    Input

    The input consists of several test cases.

    The first line of each case : A single integer, N

    The second line to N+1th of each case: line i+1 contains i space-separated integers that represent row i of the triangle.

    A line containing 0 follows the last case.(don’t process)

    Output

    For each case output a line contains the largest sum achievable using the traversal rules

    Sample Input

    5

    7

    3 8

    8 1 0

    2 7 4 4

    4 5 2 6 5

    0

    Sample Output

    30

    Hint

    Explanation of the sample:

    7

    3 8

    8 1 0

    2 7 4 4

    4 5 2 6 5

    The highest score is achievable by traversing the cows as shown above.

    H:Laser in Cuboids

    Description

    As we know ,a cuboid(rectangular solid) has three mutually perpendicular edges: a,b,c. when a,b and c are all integer ,the cuboid can be regarded as a*b*c small cubes gluing together; each of the small cube is 1*1*1

    3

    Now, as in the above figure ,there is a laser beam from one vertex to its diagonal opposite vertex ,the width of the laser is negligible,but we care about how many small cubes the lasser passes through.

    Given the integer length of the three edges of the cubooid ,your job ifs to work out how many small cubes laser passes through (not just contact with its edges or vertices)

    Input

    Each line of the input is a test case ,which contains three integer a,b and c ,0<a,b,c<1000000,the last line of input is “0 0 0”,

    Output

    For each case ,output the number of small cubes of small cubes the laser passing through

    Sample Input

    1 1 3

    2 2 3

    3 3 3

    0 0 0

    Sample Output

    3

    4

    3

    I: Currency Exchange

    Description

    Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies. There can be several points specializing in the same pair of currencies. Each point has its own exchange rates, exchange rate of A to B is the quantity of B you get for 1A. Also each exchange point has some commission, the sum you have to pay for your exchange operation. Commission is always collected in source currency.
    For example, if you want to exchange 100 US Dollars into Russian Rubles at the exchange point, where the exchange rate is 29.75, and the commission is 0.39 you will get (100 - 0.39) * 29.75 = 2963.3975RUR.
    You surely know that there are N different currencies you can deal with in our city. Let us assign unique integer number from 1 to N to each currency. Then each exchange point can be described with 6 numbers: integer A and B - numbers of currencies it exchanges, and real RAB, CAB, RBA and CBA - exchange rates and commissions when exchanging A to B and B to A respectively.
    Nick has some money in currency S and wonders if he can somehow, after some exchange operations, increase his capital. Of course, he wants to have his money in currency S in the end. Help him to answer this difficult question. Nick must always have non-negative sum of money while making his operations. 

    Input

    The first line of the input is the number of test cases. The first line of each test case contains four numbers: N - the number of currencies, M - the number of exchange points, S - the number of currency Nick has and V - the quantity of currency units he has. The following M lines contain 6 numbers each - the description of the corresponding exchange point - in specified above order. Numbers are separated by one or more spaces. 1<=S<=N<=100, 1<=M<=100, V is real number, 0<=V<=103.
    For each point exchange rates and commissions are real, given with at most two digits after the decimal point, 10-2<=rate<=102, 0<=commission<=102.
    Let us call some sequence of the exchange operations simple if no exchange point is used more than once in this sequence. You may assume that ratio of the numeric values of the sums at the end and at the beginning of any simple sequence of the exchange operations will be less than 104

    Output

    If Nick can increase his wealth, output YES, in other case output NO to the output file.

    Sample Input

    1

    3 2 1 20.0

    1 2 1.00 1.00 1.00 1.00

    2 3 1.10 1.00 1.10 1.00

    Sample Output

    YES

    November 04

    USACO Section 1.1 Your Ride Is Here 题解 (C)

    首先给出原题以及 NOCOW 的翻译: 

    Your Ride Is Here

    It is a well-known fact that behind every good comet is a UFO. These UFOs often come to collect loyal supporters from here on Earth. Unfortunately, they only have room to pick up one group of followers on each trip. They do, however, let the groups know ahead of time which will be picked up for each comet by a clever scheme: they pick a name for the comet which, along with the name of the group, can be used to determine if it is a particular group's turn to go (who do you think names the comets?). The details of the matching scheme are given below; your job is to write a program which takes the names of a group and a comet and then determines whether the group should go with the UFO behind that comet.

    Both the name of the group and the name of the comet are converted into a number in the following manner: the final number is just the product of all the letters in the name, where "A" is 1 and "Z" is 26. For instance, the group "USACO" would be 21 * 19 * 1 * 3 * 15 = 17955. If the group's number mod 47 is the same as the comet's number mod 47, then you need to tell the group to get ready! (Remember that "a mod b" is the remainder left over after dividing a by b; 34 mod 10 is 4.)

    Write a program which reads in the name of the comet and the name of the group and figures out whether according to the above scheme the names are a match, printing "GO" if they match and "STAY" if not. The names of the groups and the comets will be a string of capital letters with no spaces or punctuation, up to 6 characters long.

    Examples:

    InputOutput
    COMETQ
    HVNGAT
    
    GO
    ABSTAR
    USACO 
    STAY

    PROGRAM NAME: ride

    This means that you fill in your header with:
    PROG: ride


    INPUT FORMAT

    Line 1:An upper case character string of length 1..6 that is the name of the comet.
    Line 2:An upper case character string of length 1..6 that is the name of the group.

    NOTE: The input file has a newline at the end of each line but does not have a "return". Sometimes, programmers code for the Windows paradigm of "return" followed by "newline"; don't do that! Use simple input routines like "readln" (for Pascal) and, for C/C++, "fscanf" and "fid>>string".


    SAMPLE INPUT (file ride.in)

    COMETQ
    HVNGAT
    

    OUTPUT FORMAT

    A single line containing either the word "GO" or the word "STAY".


    SAMPLE OUTPUT (file ride.out)

    GO
    

    NOCOW 的翻译在 http://www.nocow.cn/index.php/Translate:USACO/ride


    本题是个弱智题,只给出代码和一部分的解释:


    /*

    PROB:ride

    LANG:C

    */


    #include <stdio.h>

    #include <string.h>


    int main(void) {

        /* 读入 in 文件内容 */

        FILE *inp = fopen("ride.in","r");

        if (inp == ((void *)0)) {

           printf("Error opening ride.in!\n");

           getch();

           return 1;

        }

        char ln1[7],ln2[7];

        fscanf(inp,"%s",ln1);

        fscanf(inp,"%s",ln2);

        fclose(inp);

        //printf("ln1: %s\nln2: %s\n",ln1,ln2);//

        

        /* 分析 in 文件内容 */

        int len1,len2;

        len1 = strlen(ln1);

        len2 = strlen(ln2);

        //printf("len1: %d\nlen2: %d\n",len1,len2);//

        

        /* 计算 */

        int i,j;

        int sum1 = 1;

        int sum2 = 1;

        for (i = 0;i <= len1 - 1;i++) {

            sum1 *= (ln1[i] - 64);

        }

        for (j = 0;j <= len2 - 1;j++) {

            sum2 *= (ln2[j] - 64);

        }

        //printf("sum1: %d\nsum2: %d\n",sum1,sum2);//

        

        /* 生成结果 */ 

        char result[5];

        if ((sum1 % 47) == (sum2 % 47))

           strcpy(result,"GO");

        else

            strcpy(result,"STAY");

        //printf("%s\n",result);//

        

        /* 输出到 out */

        FILE *outp = fopen("ride.out","w");

        if (outp == ((void *)0)) {

           printf("Error writeing ride.out!\n");

           getch();

           return 2;

        }

        fprintf(outp,"%s\n",result);

        fclose(outp);


        /* 结束程序 */

        //getch();//

        return 0;

    }


    说几句:

    1) 我的开发环境是 WinXP SP3, Dev-C++ 4.9.9.2 配合 VIM+GCC+GDB 的经典组合。

    2) /* */ 部分是注释, // 部分是调试代码(Dev-C++ 不好调,众所周知,所以我用 GDB + 调试代码调的)。

    3) if (inp == ((void *)0))  这里:大部分人用的是 NULL ,但是用 ((void *)0) 会快些,具体参见 GCC 的优化选项。

    4) 由于这题太简单,所以我没有写子函数。但这不是个好习惯,各位不要学习。


    Icyblade 原创,转载请书上作者名字,谢谢合作!




    May 24

    回梦游仙 记5.12四川汶川大地震

    回梦游仙 (歌词)

    神州四月天
    大地颠
    震后巴蜀忧可怜
    汶川县
    都江堰
    废墟一片
    叠纸鸢
    蜡烛点
    举国上下心相连
    夜无眠
    只是叹流年
    抗震救灾
    你我紧上弦
    有钱出钱
    有力出力
    上下一心
    全力扭转乾坤
    爱的歌声在回旋
    先前千阡灰飞烟灭
    大家重建家园
    四月天
    大地颠
    震后巴蜀忧可怜
    汶川县
    都江堰
    废墟一片
    叠纸鸢
    蜡烛点
    举国上下心相连
    夜无眠
    只是叹流年
    叹流年

    本诗系 Icyblade Wise 原创。

    若要转载请署上作者姓名,谢谢合作!

    May 13

    七律 记5.12汶川大地震

    七律 离殇

            闻道汶川震滔滔

            军民抗灾气势豪

            万家破亡人轮回

            举国上下悲寂寥

            谁言重担不可挑

            神州大地尽舜尧

            深知情在身长在

            祥云御剑彩云飘

                            作于 二〇〇八年 四月 初十


    本诗系 Icyblade Wise 原创。

    若要转载请署上作者姓名,谢谢合作!

    April 23

    水调歌头 六千缘

    水调歌头  六千缘

    红盘何时现?
    持股问证监
    不知天上石油
    何日再复现
    我与割肉清盘
    又恐后市反弹
    低位不胜寒
    牛熊分三千
    何市在人间?

    转人寿
    抛平安
    绿无眠
    不应有恨
    何时再上六千点?
    人有悲欢离合
    股有红绿涨跌
    此事古难全
    但愿牛常在
    再续六千缘!


    Icyblade 原创,转载请书上作者名字,谢谢合作!

    April 05

    数据惊魂——转载自 书琴斋

    数据惊魂二

    水竹叶

    http://violinwise.spaces.live.com/

      今天是大年初一。

       早上带着笔记本来到 Icyblade 家,本来是准备跟 Icyblade 的台式机大干一场的,结果台式机处于亚健康状态,Explorer.exe 间歇性崩溃。查看台式机发现,C: 太小,只有 5 GB 左右,不好操作,于是决定使用 Partition Manager 调整一下分区。

      按照 Icyblade 的意愿,把 E: 分 6 GB 到 C: 去。由于分区的物理连续性,这要分几个步骤实现

    1. 将 E: 前 6 GB 中的数据移动到后半部分。
    2. 将 E: 的前 6 GB 分离,并入 D:。
    3. 将 D: 前 6 GB 中的数据移动到后半部分。
    4. 将 D: 的前 6 GB 分离,并从扩展分区中分离,并入 C:。

      我们知道,有数据分区时,最危险的部分是数据移动部分。在移动数据的时候,如果出现断电或者这样那样的事情,是很不舒服的。硬盘有价,数据无价。我们盯着屏幕,看着数据被移动。

      两次数据移动操作都顺利完成,这时候要吃饭了,于是我们离开电脑,让她自己工作。

      吃到中途的时候,我觉得不对劲,侧头瞄了一下屏幕,是个黑脸,并且好像没什么反应。赶快跑过去看,BIOS 在抱怨找不到可以用来引导电脑的驱动器,硬盘已经丧失了引导电脑的能力。继续回去吃饭。

       吃完后,开始修理电脑。用 Windows Vista 光盘启动,进入命令行模式。先进入 Diskpart,List volume,发现分区都在,唯一不爽的是,E: 确实变小了 6 GB,C: 却没有变大 6 GB,那 6 GB 空间消失了!把每个分区 Dir 一次,发现数据都在,嗯,稍微舒服了一下。再 Chkdsk 每个分区,结果竟然说 C: 是 RAW 格式,不能检查,又不爽了,刚才 Dir 不是说是 FAT32 格式吗?怎么又变成 RAW 了呢?

      不管怎样,硬盘不能引导,说明 MBR 坏了,先把 MBR 修好吧。用 Windows XP 光盘启动,一切顺利,唯独 Icyblade 把管理员密码忘了……

      那就启动到 DOS 下面去吧,用 Ghost 恢复。但是没有 DOS 启动盘,手头只有 Icyblade 的 MP3,只有考虑把这个 MP3 做成启动盘了。

      在笔记本上用 USBoot 制作启动盘,无奈无论用什么方式都不能引导台式机,可能是没有掌握诀窍吧,以前从没做过 USB 启动盘。

      Partition Manager 提供了一个 Recovery CD 的镜像,本来用这个是最合适的,我的笔记本也可以刻录,但是 Icyblade 家没有刻录盘。现在别的路走不通,只有出去买刻录盘了。

       先去旁边的好又多,一会儿就发现了刻录盘,不过被锁起来了。问旁边的员工,说刻录盘没有上架,不能卖。没办法,乘车去附近的江汉路沃尔玛,拿了一盒 Maxell,标价 22.5,出门的时候竟然成了 29.5,今天真是备受挫折啊。去服务台理论,过程省略,结果由于深刻地认识到了时间就是金钱,我们带着不满离开了。

      回来后将 Recovery CD 刻录出来,引导台式机,顺利启动到了 Partition Manager,发现 C: 连同分离出来的 6 GB 成了未分配空间,可怜啊……

      让 Partition Manager 在这 11 GB 未分配空间中查找分区,顺利地找到了一个 11 GB 的 FAT32 分区,执行恢复操作,然后将恢复出来的分区激活,重新启动,硬盘引导成功了。

      到这里问题就解决了,整个过程也很清晰,唯一不足的是,一开始 Partition Manager 是怎么把硬盘弄坏的咧?当时在吃饭,整个过程没有看到,现在还是想不通。

      最后,祝大家在新年里玩得愉快!

    原创文章,如转载请附上作者和本博客地址,谢谢!

         

          本来笔者坐庄的,可不小心被 Violin 抢了先。转载一下,也省了不少心呵。

    March 05

    3.8 妇女节致词

    Technorati 标签:

    漂浮的云

    您的伟大 凝结了我的血肉
    您的伟大 塑造了我的灵魂
    您的一生 是一次爱的航行
    您用优美的年轮
    编成一册散发油墨清香的日历
    年年 我都在您的深情里度过
    在您的肩膀和膝头嬉戏

    您是一棵大树
    春天 倚着您幻想
    夏天 倚着您繁荣
    秋天 倚着您成熟
    冬天 倚着您沉思
    您那高大宽广的树冠
    使四野永不荒野
    母亲 您给了我生命
    您是抚育我成长的土地

    在悲伤时 您是慰藉
    在沮丧时 您是希望
    在软弱时 您是力量
    在您小小海湾中躲避风雨
    您为我开阔了视野
    您是我永远的挚友 生命的动力

    您怀着爱怜 谨慎地俯身守护
    您尽情袒露明亮的胸襟
    您旺盛的精力笑容坚强
    您沸腾的血液奔流不息

    让我沉浸在您的欢乐中
    让我享受在您的温馨中
    让我陶醉在您的双臂间
    让我偎依在您的怀抱里

    悠悠的云里有淡淡的诗
    淡淡的诗里有绵绵的爱
    绵绵的爱里有深深的情
    深深的情里有浓浓的意

    如果母亲是雨 那我就是雨后的虹
    如果母亲是月 那我就是捧月的星
    母亲是我生长的根
    我是母亲理想的果
    思想的独舞
    如果母亲是雨 那我就是雨后的虹
    如果母亲是月 那我就是捧月的星
    母亲是我生长的根
    我是母亲理想的果

    February 03

    《PowerShadow2008》psNotify.dll 和 ChNormal.dll 文件再分析

    又现别洞天

            前几天(2008年1月31日)我把《PowerShadow2008》的两个DLL动态链接库 psNotify.dll 和 ChNormal.dll 误删后,并没有把它们还原(因为我觉得既然这两个DLL动态链接库只与你那输入框有关,我又根本没有设置密码)。

            昨天(2008年2月2日),出问题了: explorer.exe 崩溃。据统计,最“强”的一次,每3分钟崩溃一次!我简直不敢相信我的眼睛,要知道,连 Windows 98 那著名的“蓝屏”故障都没有这么高的频率!崩溃一次两次倒不要紧,可每3分钟崩溃一次也让人太受不了了吧!为了挽救我的“瘟豆子”,我开始了研究 explorer.exe 的旅程……

            刚开始,我以为是 explorer.exe 文件内部出了问题。于是我就用 expand 命令把 XP 的安装光盘中的 explorer.ex_ 解压出来,把 C:\WINDOWS 下的explorer.exe 给覆盖了。本想就这样就好了的,可是刚刚退出“资源管理器”, explorer.exe 又崩溃了!我怒火中烧,微软也太欺负人了吧!

            我静下心来想了想,既然不是 explorer.exe 的问题,会不会是 explorer.exe 中的DLL模块中有一个有问题呢?于是,我打开 IceSword V1.22 ,查看了一下 explorer.exe 的模块信息,发现有一个 flb.dll 模块有点不正常。这个 flb.dll 是 Free Launch Bar 里的一个DLL动态链接库,用于驱动任务栏上的FLB工具栏。我用MD5DEEP 算了算 flb.dll 的MD5值,发现这个MD5值与我用 Universal Extractor 从安装包里解出来的不一样。我心中暗喜,小样,穿马甲我就不认识你了?

            于是,我就把 Free Launch Bar 给卸载了。重启后果然好多了。我又等了一刻钟(武汉方言,指15分钟),没崩溃。我刚准备点“开始”菜单关机,任务栏突然不见了!靠,又崩溃了!看来还有更根本的原因。因为那时已是晚上10点半了,我不得不放弃,准备明天再来。

            关电脑后,老妈叫我去 Taking point (是我们武汉市第一初级中学 初二(8)班特有的词,指 蹲点,即上厕所)。我从书架上拿了本 《Windows Vista 使用详解》,想从中得到一点启示,毕竟 Vista 和 XP 都是微软那苕儿子(高土坪(位于神农架)土话,我的班主任是高土坪来的,但是英语的确不赖)做的嘛。我翻开《Windows Vista 使用详解》,映入我的眼帘的是五个黑体大字:“事件查看器”我猛地从马桶上跳起来——为什么不用“事件查看器”看看到底是什么原因导致 explorer.exe 崩溃的呢?

            今天下午,我完成了我的“硬盘MOD”后,把老爸从电脑上赶下来,打开“事件查看器”,映入眼帘的,是“应用程序”项中的信息 “Winlogon” 。我双击打开,出现了这么一幅图片:winlogon

            这时,我终于知道了 explorer.exe 崩溃的原因:是由 winlogon.exe 引起的!

            回想到前几天(2008年1月31日)我把插入到 winlogon.exe 中的DLL动态链接库 psNotify.dll 和 ChNormal.dll 误删除而没有恢复,我明白了:虽然我把psNotify.dll 和 ChNormal.dll 给粉碎了,但 PowerShadow 2008 中仍然有一个“机制”想调用这两个DLL。但实际上,C:\WINDOWS\system32 下的那两个DLL动态链接库中的内容只是“360IceBrekaer Tech”,于是,当这个“机制”试图调用psNotify.dll 和 ChNormal.dll 时,系统便崩溃了,由于我在“启动和故障恢复”中把“自动重新启动”给关闭了,所以系统只能把 explorer.exe 重新启动。那个“任务栏消失”不是 explorer.exe 崩溃,而是explorer.exe 重启!

            知道了问题的根源,问题就简单了。我马上把那两个DLL给拷回C:\WINDOWS\system32 。系统提示没有足够权限。怎么回事,我登录的可是管理员帐户啊?

            我想了想,眼光飘到任务栏上的360安全卫士的图标上。哦!我豁然开朗。我把C:\WINDOWS\system3 2 下的那两个DLL粉碎时,设置了“阻止被粉碎文件再次生成”。所以360安全卫士阻止我把它们删除。于是,我马上打开360安全卫士,再次把它们粉碎。这次,我没有选择“阻止被粉碎文件再次生成”。粉碎后,我再次覆盖,成功!

            于是我开始写这篇Blog。直到现在,还没出现崩溃的症状。啊......自豪感和幸福感悠然而生......

     

    若要转载,请署上作者姓名!

    http://icybladewise.spaces.live.com/

    February 01

    《PowerShadow2008》psNotify.dll 和 ChNormal.dll 文件分析 暨 《360安全卫士V3.7文件粉碎机》功能分析

    别洞天

            在《电脑报2006年合订本》上市之际,我第一时间在新华书店将它拉回家。《合订本》配套光盘中带了一个1年正版支持的《影子系统PowerShadow 2008》。我去年曾用过 PowerShadow 2007 ,功能的确不错的,于是我就把它架上我的电脑。那天是 2008年1月25日。 

            昨天,因为我的 Norton Anti-Virus 2003 不能升级了,我用HijackThis V2.0、IceSword V1.22  和 360安全卫士对系统作了个全面扫描。这时我发现HijackThis报告有psNotify.dll线程插入winlogon.exe。我心里一惊,难不成真有病毒?于是,我就开始了psNotify.dll的研究。

            首先,我用360安全卫士的“系统进程状态”功能查看了所有进程的线程模块情况(主要是看DLL模块的公司名称是否正常),发现在winlogon.exe进程中有 psNotify.dll 和ChNormal.dll 两个DLL模块。它们都在 C:\WINDOWS\system32 文件夹下。我查看了它们的属性,都没有公司描述。我的直觉告诉我它们有问题。我马上用 IceSword 把者两个模块卸除,把它们拷到D:\Temp后用《360安全卫士V3.7文件粉碎机》将它们粉碎(设置“阻止被粉碎文件再次生成”)。重新启动后用IceSword检察,发现 winlogon.exe 中已没有这两个模块。我心里一喜,以为就这样就完了。

            第二天,我打开电脑,准备研究一下这两个DLL文件的运行机理。我定位到 D:\Temp ,首先用 PEiD 查看了这两个文件是否加壳。PEiD 报告“什么也没有发现”。我用 Norton Anti-Virus 2003 查杀,竟报告没毒?!我感到万分郁闷,于是上网 Google 一下,发现360安全论坛上有人说这两个DLL动态链接库是《影子系统PowerShadow 2008》的,与密码输入框有关。难道真是这样?我用 WinHEX 打开这两个DLL动态链接库,搜索 shadow ,发现在 psNotify.dll 文件的74538-74543选块、 ChNormal.dll 文件的174754-174775选块出现了“shadow”这个词,而且上下文中也有关于 PowerShadow 的字眼。并且在 ChNormal.dll 文件的172561-172655选块发现字符串“!"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~”、在172945-173039选块发现字符串“!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~”这两个string有力地说明了psNotify.dll 和 ChNormal.dll 两个文件与《影子系统PowerShadow 2008》的密码输入功能有关。

            于是我就把D:\Temp\psNotify.dll 和 D:\Temp\ChNormal.dll拷回 C:\WINDOWS\system32 。这时,系统提示是否覆盖文件?!我不是把 C:\WINDOWS\system32\psNotify.dll 和 C:\WINDOWS\system32\ChNormal.dll 给粉碎了吗?还设置了“阻止被粉碎文件再次生成”?难道《360安全卫士V3.7文件粉碎机》名不符实?我用 IceSword 打开文件夹 C:\WINDOWS\system32 ,定位到 ChNormal.dll ,竟发现 ChNormal.dll 竟然只有19B大小?而原来的 ChNormal.dll 有224KB!怎么回事?

            我用 WinHEX 开 C:\WINDOWS\system32\ChNormal.dll ,发现只有这么两行字:“360IceBrekaer Tech”!C:\WINDOWS\system32\psNotify.dll 也是如此。并且 C:\WINDOWS\system32\ChNormal.dll 和 C:\WINDOWS\system32\psNotify.dll 都无法删除。

            我恍然大悟。原来《360安全卫士V3.7文件粉碎机》在打开设置“阻止被粉碎文件再次生成”时,《360安全卫士V3.7文件粉碎机》会将被粉碎的文件粉碎后用19B的文件代替,并设置权限使它们不能被删除。我以前用过的文件粉碎机只有单纯粉碎文件的功能,没想到《360安全卫士V3.7文件粉碎机》又有创新。我们不得不感叹,科技发展真快啊!

    总结:

    1.发现疑似病毒时,不能一刀切下去,而要多分析分析,仔细考察它们是不是病毒。

    2.当我们无法认定某文件是不是病毒时,我们可以利用网络这个工具帮助我们。

    若要转载,请署上作者姓名!

    http://icybladewise.spaces.live.com/

    November 25

    《第十届湖北省青少年无线电制作竞赛(荆楚杯)》赛后感想

    哀幻瞑
             2007年11月25日,我和学校五位同学在付老师的带领下前往武汉市东湖中学参加《第十届湖北省青少年无线电制作竞赛(荆楚杯)》。这个竞赛是直接由湖北省科学技术协会湖北省教育厅主办,湖北省青少年科技中心承办的一个省级竞赛。这次初中组的赛题是“亚超声遥控灯”。只要捏一下一个带嘴哨的气球,“吱”的一声,小灯就亮了。再捏一下,小灯又熄灭了。这样就方便、安全、准确地实现了灯的声控化,而且鼓掌、顿足、呼喊也不能让灯熄灭。这样的灯就叫做亚超声(18KHz)遥控灯
            该灯的电路由直流7.5V供电电路、触发信号产生电路、双稳态电路和负载组成。捏一下气球以后,哨嘴发出18KHz亚超声波,引起空气振动,而空气又引起压电晶体蜂鸣器振动。压电晶体蜂鸣器将机械振动转化为电信号输出,经三极管VT1(9014)放大后,由VT1的集电极的并联谐振回路选取18KHz信号,经过耦合电容C2(1微法)送到三极管VT2(9012)进行放大和整形,形成尖脉冲近R3(100Ohm)、C3(1微法)输出能控制双稳态电路的触发信号。双稳态电路由三极管VT3、VT4(9014)等元件组成,具有对称性。理论上控制距离为5米,但由于种种原因(诸如元件质量、焊接技术等)实际控制距离仅有1米左右。
            参赛之前我们的心情就很紧张。结果电源线就遗忘在学校中,只得使用给的线。但这线着实太水,总是断。我摆弄这线就花了我总时间的10%左右。同时又因为第一场的23位考生遇到了一点麻烦,所以我们这一考场的23名同学只得换考场,其中有我和另一位“战友”Wang。这些问题是我本来就紧张的心更添了一份沉重。我花了1小时不到成功完成了作品,但我却认为我并没有发挥出我的水平。Wang遇到了一点麻烦,接上了电源后电感发热的可怕。我俩忙活了半天,到了最后还是没搞清楚是怎么回事。若有那位同志知道的,请在博客上留言。我代表我们学校感谢大家了!
            在返回学校的途中,我们互相交换了一下战果。很遗憾,6位同学中仅仅Wang没做成。但也足够了,毕竟成绩并不重要,过程才是最重要的
     
    若要转载,请署上作者姓名!