文章列表
装饰模式,利用了setComponent来对对象进行包装。
class Person {
private String name;
public Person(){}
public Person(String name){
this.name = name;
}
public void show() {
System.out.println("装扮的" + name);
}
}
// 装饰类
class Decorator extends Person{
protected Person person;
pub ...
#include <stdio.h>
int main(){
long L;
long N,C,T;
long VR,VT1,VT2;
long p[102];
long len;
int i,j;
double time,min,tmp[102];
while(scanf("%ld",&L) != EOF){
scanf("%ld %ld %ld",&N,&C,&T);
scanf("%ld %ld %ld",&VR,& ...
- 2009-11-08 22:35
- 浏览 1583
- 评论(0)
Problem Description:
A number sequence is defined as follows:
f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.
Given A, B, and n, you are to calculate the value of f(n).
Input:
The input consists of multiple test cases. Each test case contains 3 integers A, B and n on a single line ( ...
- 2009-10-28 11:18
- 浏览 1402
- 评论(0)
Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, ...
shows the first 11 ugly numbers. By convention, 1 is included.
Write a program to find and print the 1500'th ugly number.
Input and Output:
There is no input to this program. Out ...
- 2009-10-25 20:27
- 浏览 1212
- 评论(0)
很久以前,偶还是高中生的时候,母校的老师上计算机课时,总是不无自豪的说起校友求伯君。是啊,那时的求伯君无愧为中国第一程序员,我们谈他的WPS,很有把 MS 的office 打垮的劲头。那时很崇拜他,程序员让我很是眩晕。随之而来的,就是对 ACMer 和信息学拿奖者的敬仰。
以后,由于专业的关系,很少触及竞赛方面的编程。感觉 ACM 离我很远。。。
现在,潜回宁静的校园,一不小心碰了下ACM,呵呵,发现里面的世界挺有趣,有好多和实际问题相关的例子,精妙的求解过程,让人读了很是舒服。于是,不由感叹,要是年轻几岁多好啊。。。当然,虽说现在已过了参赛的年龄,但看看那些题目,自己试 ...
- 2009-10-25 20:23
- 浏览 708
- 评论(0)