Author Archives: admin - Page 2

PKU 1088 解题报告

滑雪

Time Limit: 1000MS Memory Limit: 65536K

Description

Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子

 1  2  3  4  5
 
16 17 18 19  6
 
15 24 25 20  7
 
14 23 22 21  8
 
13 12 11 10  9

一个人可以从某个点滑向上下左右相邻四个点之一,当且仅当高度减小。在上面的例子中,一条可滑行的滑坡为24-17-16-1。当然25-24-23-...-3-2-1更长。事实上,这是最长的一条。

Input

输入的第一行表示区域的行数R和列数C(1 <= R,C <= 100)。下面是R行,每行有C个整数,代表高度h,0<=h<=10000。

Output

输出最长区域的长度。

Sample Input

5 5
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9

Sample Output

25

Source

SHTSC 2002

太长时间没有写代码了,我已经离这个领域越来越远了.快毕业了,编程对于我的意义也不是很大了,我将来所从事的行业用到程序设计的机会不会很多.如慧慧所说,ACM,程序设计什么的对于我也只剩一点精神上的东西了.

......

Read more »

混凝土浇筑模板侧压力计算

在进行混凝土结构模板设计时,常需要知道新浇注混凝土对模板侧面的最大压力值,以便据此计算确定模板厚度和支撑的间距等.

混凝土作用于模板的侧压力,根据测定,随混凝土的浇注高度而增加,当浇注高度达到某一临界值时,侧压力就不再增加,此时的侧压力即为新浇注混凝土的最大侧压力.侧压力达到最大值的浇注高度称为混凝土的有效压头.通过理论推导和实验,国内外推出过很多混凝土最大侧压力的计算公式,现选取我国《混凝土结构工程施工及验收规范》(GB50204-92)中提到的新浇注混凝土作用在模板上的最大侧压力计算公式如下:

\( F = 0.22 \gamma_c t_0 \beta _1 \beta _2 V^\frac{1}{2} \)

\( F = \gamma _c H \)

当采用内部振捣器时,新浇筑的混凝土作用于模板的侧压力标准值,可按下列公式计算,并取其中的较小值,

其中

\( F \)-新浇混凝土对模板产生的最大侧压力(kN/m2);

\( H \)-有效压头高度(m);

\( V \)-混凝土浇筑速度(m/h);

\( t_0 \)-混凝土入模时的温度(℃);

\( \gamma_c \)-混凝土的容重(kN/m3);

\( K \)-外加剂影响修正系数,不掺外加剂时取k=1.0,掺缓凝作用的外加剂时k=1.2;

\( \beta _1 \)-外加剂影响修正系数,不掺外加剂时取1.0;掺具有缓凝作用的外加剂时取1.2;

\( \beta _2 \)-塌落度影响修正系数,当塌落度小于30mm时,取0.85;50-90mm时,取1.0;110-150时,取1.15.

混凝土的有效压头高度H如下取值:

\( V/t_0<0.035 \)时,\( H=0.22+24.9V/t_0 \);

\( V/t_0>0.035 \)时,\( H=1.53+3.8V/t_0 \);

......

Read more »

女神大桥

在工地生活了三个月,很幸苦,都没有什么时间精力写日志.

十月份开始回学校上课,《大跨度桥梁》(Long Span Bridges)这门课让人有点头疼,课本全英文,念的最差的就是英语了.不过还好,这是一门科普知识课,了解一下当今世界著名的大跨度桥梁......

第一节课,感觉有点走马观花,就记住日本长崎的女神大桥,回来搜索了一下资料,不知道是不太出名还是什么,网络上关于女神大桥的中文资料不多,在日本一个网站上找了一点,简单的介绍一下这位女神.

女神大桥坐落于长崎港,将长崎市分断的南部和西部以最短的距离连接,缓和了市中心的交通混乱,实现了活化全域的产业、经济、文化。将来,与长崎外环线合为一体,形成干线道路网络。另外,本桥为斜拉桥,创造了魅力的地域形象。作为地域标志,也期待它成为观光县长崎的新标志(Yuki 译)。

 

高架桥俯瞰

主塔俯瞰女神大桥

Read more »

Goodbye Dennis Ritchie!

#include<stdio.h>
 
int main()
{
    printf("Goodbye Dennis Ritchie!n");
    return 0;
}

Read more »

SDCC编译器简明使用教程

先前翻译了SDCC编译器手册第一章的内容,尝试过去翻译其他章节,不过难度似乎比我预计的要大,在google的帮助下也完成不了,现在只能结合自己的使用写点了.

本文以SDCC手册第三章内容为基础!

这里不介绍SDCC的安装过程,作为电气工程专业或者计算机嵌入式方向的学生这不是什么困难的事!安装后把SDCC的bin目录添加到path环境变量使得你能在任何目录下使用SDCC,使用archlinux和debian系统的没有这一步,安装时已经自动配置好了!我平时很少使用集成开发工具(IDE)写代码,所以编辑源代码你可以使用你最拿手的工具,任何文本编辑器都可以,我使用的是vim!

源代码与Keil C的稍许不同

对于已经习惯使用Keil C的用户需要注意一下,SDCC的源代码和Keil C有所不同,需要做一点调整才能编译通过.SDCC比较多的使用像8051.h这样的头文件(include/mcs51目录下也有reg51.h这样的头文件).

对于一些非ANSI C的关键字,SDCC均采用双下滑线开头的方式定义,如__code,__idata,__sbit......对于单片机引脚的定义SDCC采用了__at关键字和十六进制地址(用户对底层地址信息要弄清楚,不过我觉得__at关键字是一个比较有特色的改进),如下:

//SDCC                                      Keil C
__sbit __at 0x94 blackLineLeft;         sbit blackLineLeft=P1^4;
__sbit __at 0x95 blackLineRight;        sbit blackLineRight=P1^5;
__sbit __at 0x80 in1;                   sbit in1=P1^0;
__sbit __at 0x81 in2;                   sbit in2=P1^1;
__sbit __at 0x82 in3                    sbit in3=P1^2;
__sbit __at 0x83 in4;                   sbit in4=P1^3;

更多的地址信息可以查看附录

对于内嵌汇编代码,SDCC使用__asm和__endasm两个关键字,参考代码如下:

void delay0_1(uint n) {
    for(i=0;i<n;++i) {
        for(j=0;j<10000;++j) {
            __asm
              nop
              __endasm;
        }
    }
}

......

Read more »

ZOJ 1514 解题报告

Fake Tickets

Time Limit: 1 Seconds Memory Limit: 32768 KB

Your school organized a big party to celebrate your team brilliant win in the prestigious, worldfamous ICPC (International Collegiate Poetry Contest). Everyone in your school was invited for an evening which included cocktail, dinner and a session where your team work was read to the audience. The evening was a success - many more people than you expected showed interested in your poetry - although some critics of yours said it was food rather than words that attracted such an audience.

Whatever the reason, the next day you found out why the school hall had seemed so full: the school director confided he had discovered that several of the tickets used by the guests were fake. The real tickets were numbered sequentially from 1 to N (N <= 10000). The director suspects some people had used the school scanner and printer from the Computer Room to produce copies of the real tickets. The director gave you a pack with all tickets collected from the guests at the party's entrance, and asked you to determine how many tickets in the pack had 'clones', that is, another ticket with the same sequence number.

Input

The input contains data for several test cases. Each test case has two lines. The first line contains two integers N and M which indicate respectively the number of original tickets and the number of persons attending the party (1 <= N <= 10000 and 1 <= M <= 20000). The second line of a test case contains M integers Ti representing the ticket numbers in the pack the director gave you (1 <= Ti <= N). The end of input is indicated by N = M = 0.

Output

For each test case your program should print one line, containing the number of tickets in the pack that had another ticket with the same sequence number.

Read more »

ZJU 1101 解题报告

Gamblers

Time Limit: 1 Seconds Memory Limit: 32768 KB

A group of n gamblers decide to play a game:

At the beginning of the game each of them will cover up his wager on the table and the assitant must make sure that there are no two gamblers have put the same amount. If one has no money left, one may borrow some chips and his wager amount is considered to be negative. Assume that they all bet integer amount of money.

Then when they unveil their wagers, the winner is the one who's bet is exactly the same as the sum of that of 3 other gamblers. If there are more than one winners, the one with the largest bet wins.

For example, suppose Tom, Bill, John, Roger and Bush bet $2, $3, $5, $7 and $12, respectively. Then the winner is Bush with $12 since $2 + $3 + $7 = $12 and it's the largest bet.

Input

Wagers of several groups of gamblers, each consisting of a line containing an integer 1 <= n <= 1000 indicating the number of gamblers in a group, followed by their amount of wagers, one per line. Each wager is a distinct integer between -536870912 and +536870911 inclusive. The last line of input contains 0.

Output

For each group, a single line containing the wager amount of the winner, or a single line containing "no solution".

Read more »