2008-04-09
我真无聊,正在作弊
关键字: 面试题 public static void main(String[] args) {
List max = new ArrayList();
for(int i = 0;i<100;i++){
max.add(""+i);
for(int j =0 ; j <1000; j++){
for(int k = 0 ; k <1000; k++){
if(5*j+7*k==i){
max.remove(""+i);
//System.out.println(i+"\t="+j+"*5+"+k+"*7");
}
}
}
}
System.out.println(max);
}
某个小学生题的解
评论
citi.sh
2008-07-30
[1, 2, 3, 4, 6, 8, 9, 11, 13, 16, 18, 23]
抛出异常的爱
2008-04-11
script/conslor
create table people ( id int not null auto_increment, name varchar(100) not null, primary key(id) ); create table tasks ( id int not null auto_increment, name varchar(100) not null, importance varchar(100) not null, primary key(id) ); drop table tasks_people; create table people_tasks ( person_id int , task_id int , constraint fk_cp_task foreign key (task_id) references tasks(id), constraint fk_cp_person foreign key (person_id) references people(id) );
d=[]
Person.find_by_name("mao").Tasks.each do
|task|
d.push(task) if(task.importance.eql?("H")||task.importance.eql?("M"))
end
抛出异常的爱
2008-04-11
class NameBean
include Comparable
attr :str
def initialize(str)
@str= str
end
def getValue
str.split(":")[1].to_i
end
def <=> (other)
getValue<=>other.getValue
end
end
class LikeRuby
def getListByNameBean (a)
d=[]
a.each do
|str|
tmp= NameBean.new(str)
d.push(tmp)
end
d
end
def getListForString(str)
list=str.split(",")
d=getListByNameBean(list);
d.sort
end
def printByAge (list)
rs=""
list.each do
|bean|
rs=rs+ bean.str
rs=rs+","
end
rs.chomp(",")
end
endirb.bat
b= a.getListForString "mao:20,da:10,jun:30"
a.printByAge(b)







评论排行榜