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
end

irb.bat

b= a.getListForString "mao:20,da:10,jun:30"
a.printByAge(b)
发表评论

您还没有登录,请登录后发表评论

抛出异常的爱
搜索本博客
我的相册
1569dbfd-b702-3ce0-a83c-605b146f22c2-thumb
长椅
共 39 张
存档
最新评论
  • 天狗食日
    看了。。。英雄(美剧)。。。。 之后就非常想要见识一下日食了 谢谢
    -- by 抛出异常的爱
  • 天狗食日
    按照月亮运行规律来讲,一个月就会出现一次日食,并且今年出现日食时间和明年差不多, ...
    -- by ddd
  • 天狗食日
    貌似是在西安和郑州啊!
    -- by lordhong
  • 天狗食日
    郁闷坏我了,下班时不坐地铁,特意坐公交为了在车上看到日食,6点钟的太阳还是很刺眼 ...
    -- by nighthawk
  • 天狗食日
    http://www.pmo.jsinfo.net/这里可以在线观看
    -- by cxianf