博文
2007 SJTU 计算机复试上机试题(转载)(2007-04-12 18:18:00)
摘要:2007 SJTU 计算机复试上机试题(转载)
Problem A. Old Bill
Input file: standard input
Output file: standard output
Among grandfather's papers a bill was found.
72 turkeys $_679_
The first and the last digits of the number that obviously represented the
total price of those turkeys are replaced here by blanks (denoted _), for
they are faded and are illegible. What are the two faded digits and what
was the price of one turkey?
We want to write a program that solves a general version of the above
problem.
N turkeys $_XYZ_
The total number of turkeys, N, is between 1 and 99, including both. The
total price originally consisted of five digits, but we can see only the
three digits in the middle. We assume that the first digit is nonzero, that
the price of one turkeys is an integer number of dollars, and that all the
turkeys cost the same price.
Given N, X, Y, and Z, write a program that guesses the two faded digits and
the ......
PPLive网页例程(2007-04-09 03:28:00)
摘要:<table border="0" cellpadding="0" cellspacing="0"><tr><td><object id="PPLiveP" style="width:480px;height:377px;" classid="CLSID:18226BF8-DC0B-4D81-80E9-A41AE37BB73A" codeBase="http://download.pplive.com/webinstall/install.CAB#version=1,5,34">
<param name="ControlVisible" value="0" />
<param name="ShowP2P" value="1" />
<param name="ShowBufferAD" value="1" />
<param name="DBClickFullScreen" value="1" />
<param name="ShowGall" value="1" />
<param name="ShowPlayCtrl" value="1" />
<param name="URL" value="" />
<param name="ShowMenu" value="1" />
</object>
</td><td><object style="width:220px ; height:377px" classid="CLSID:70CACCCA-8B83-4BCB-B2D1-188E9A495527"></object></td></tr></table><script type="text/javascript">var PPlivePlayer=document.getElementById("PPLiveP");window.onunload=function(){try{PPlivePlayer.Dest......
getchar&getch&getche(2006-10-11 00:05:00)
摘要:getchar
This is a standard function that gets a character from the stdin.
getch
This is a nonstandard function that gets a character from keyboard, does not echo to screen.
getche
This is a nonstandard function that gets a character from the keyboard, echoes to screen.
Use getchar if you want it to work on all compilers. Use getch or getche on a system that supports it when you want keyboard input without pressing [Enter].
And note that the return value of all three is int! You need this to properly check for EOF. ......
用java模拟生产者与消费者问题(2006-04-25 22:05:00)
摘要:package lly;
public class Box
{
private int value;
private boolean available = false;
public synchronized int get()
{
while (available == false)
{
try
{
// 等待生产者写入数据
wait();
} catch (InterruptedException e)
{
// TODO: handle exception
&n......
申请二维空间(2006-01-01 22:00:00)
摘要://**************申请二维空间**************************
m_ImageData=new BYTE*[m_nHeight];//检索表
*m_ImageData=new BYTE[m_nHeight*m_nWidth];//存储空间
for(int k=0;k<m_nHeight;++k)
{
m_ImageData[k]=m_ImageData[0]+m_nWidth*k;//配置检索表
}//for
//****************************************************......
利用VC实现图像的特殊显示效果(2006-01-01 21:58:00)
摘要:利用VC实现图像的特殊显示效果
一、"浮雕"图像
"浮雕"效果是指图像的前景向前凸出背景。所谓的"浮雕"处理就是指图像上的一个像素和它左上方的那个像素之间差值的一种处理过程。
为了使图像保持一定的亮度并呈现灰色,在处理过程中为这个差值加了一个数值为128的常量。
当设置一个像素值的时候,它和它左上方的像素都要被用到,为了避免用到已经设置过的像素,应该从图像的右下方的像素开始处理,下面是实现的VC源代码:
int i,j,buf;
for( i=pBi->biHeight-1; i>=2; i--)
{
for( j=width-1; j>=2; j--)
{
//"浮雕"处理
buf=*(pD+i*width+j)-*(pD+(i-1)*width+j-1)+128;
if(buf>......
匈牙利符号表示法的前缀代码指导说明书(2006-01-01 21:54:00)
摘要:匈牙利符号表示法的前缀代码指导说明书
_______________________________________________________________________________
前缀 | 数据类型(基本类型)
_______________________________________________________________________________
c | 字符
by | 字节(无符号字符)
n | 短整数和整数(表示一个数)
i | 整数
x,y | 短整......
常见位图类型(2006-01-01 21:53:00)
摘要:‘BM’ : Windows 3.1x, 95, NT, …
‘BA’ :OS/2 Bitmap Array
‘CI’ :OS/2 Color Icon
‘CP’ :OS/2 Color Pointer
‘IC’ : OS/2 Icon
‘PT’ :OS/2 Pointer
......
约瑟夫环程序(顺序实现)(2005-05-03 22:48:00)
摘要:本程序用顺序表实现,相对复杂一点了
#include
#include
#include
#define ok 1
#define error 0
#define overflow -2
typedef int status;
typedef struct node{
int number;
int password;
}node;
typedef struct sqlist{
node *elem;
int length;
int listsize;
}sqlist;
void initlist(sqlist &l,int n) /* 初始化函数*/
{ int i; node *newbase;
newbase=(node *)malloc(n*sizeof(node));
if(!newbase) exit(overflow);
l.elem=newbase;
printf("Input %d password.\n",n);
for(i=0;i......
约瑟夫环程序(2005-05-03 22:47:00)
摘要:此程序用链表实现,比较简单.
#include
#include
#include
#define overflow -2
#define ture 1
#define False 0
typedef struct circle{
int number;
int password;
struct circle *next;
}circle,*linkcircle;
void initcircle(linkcircle &l,int n) /*初始化循环单链表*/
{ int i; linkcircle p,newbase;
newbase=(linkcircle)malloc(sizeof(circle));
if(!newbase) exit(overflow);
p=l=newbase;
printf("Input %d passwords:\n",n);
for(i=1;i......