06 2016 档案

Collections.addAll 为什么比collection.addall 快(转)
摘要:from: http://stackoverflow.com/a/3343829/5032462 在stackoverflow上看到的一篇回答,老外真是太professional了,mark一下。最后的summary值得看一下。 The Java API docs say the following 阅读全文

posted @ 2016-06-12 16:35 北门煎饼东门串儿 阅读(1006) 评论(0) 推荐(0)

1015. Reversible Primes (20)
摘要:A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a re 阅读全文

posted @ 2016-06-12 09:52 北门煎饼东门串儿 阅读(154) 评论(0) 推荐(0)

1010. Radix (25)
摘要:1011. World Cup Betting (20) With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players 阅读全文

posted @ 2016-06-12 09:45 北门煎饼东门串儿 阅读(174) 评论(0) 推荐(0)

1009. Product of Polynomials (25)
摘要:This time, you are supposed to find A*B where A and B are two polynomials. Input Specification: Each input file contains one test case. Each case occu 阅读全文

posted @ 2016-06-10 17:50 北门煎饼东门串儿 阅读(112) 评论(0) 推荐(0)

1008. Elevator (20)
摘要:The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elev 阅读全文

posted @ 2016-06-08 10:57 北门煎饼东门串儿 阅读(144) 评论(0) 推荐(0)

1004. Counting Leaves (30)
摘要:A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Each input file contain 阅读全文

posted @ 2016-06-08 10:45 北门煎饼东门串儿 阅读(262) 评论(0) 推荐(0)

Arrays.asList 小结
摘要:Arrays.asList()返回一个实现了List接口的类,但是不支持add,remove等改变尺寸的操作。 Arrays.asList源码如下 这里有一个大坑,我开始没仔细看,以为返回的就是java.util.ArrayList,可实际上此ArrayList是Arrays里面的私有静态内部类,代 阅读全文

posted @ 2016-06-07 23:11 北门煎饼东门串儿 阅读(151) 评论(0) 推荐(0)

1005. Spell It Right (20)
摘要:Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specificat 阅读全文

posted @ 2016-06-07 19:55 北门煎饼东门串儿 阅读(164) 评论(0) 推荐(0)

1006. Sign In and Sign Out (25)
摘要:At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door 阅读全文

posted @ 2016-06-07 19:53 北门煎饼东门串儿 阅读(219) 评论(0) 推荐(0)

1002. A+B for Polynomials (25)
摘要:This time, you are supposed to find A+B where A and B are two polynomials. Input Each input file contains one test case. Each case occupies 2 lines, a 阅读全文

posted @ 2016-06-07 11:12 北门煎饼东门串儿 阅读(178) 评论(0) 推荐(0)

Java中浮点数能连续精确表示整数的范围
摘要:转自http://blog.csdn.net/seizef/article/details/5571783#ref_1,有删改。 先简单介绍一下浮点数在计算机中的组成,在Java中采用的浮点数表示法是IEEE754标准。 任意一个二进制浮点数V可以表示成下面的形式,进一步说明请参照[1]: (1)( 阅读全文

posted @ 2016-06-07 10:07 北门煎饼东门串儿 阅读(905) 评论(0) 推荐(0)

1001. A+B Format (20)
摘要:Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less t 阅读全文

posted @ 2016-06-06 19:06 北门煎饼东门串儿 阅读(102) 评论(0) 推荐(0)

1003. 我要通过!(20)
摘要:“答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于PAT的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。 得到“答案正确”的条件是: 1. 字符串中必须仅有P, A, T这三种字符,不可以包含其它字符;2. 任意形如 xPATx 的字符 阅读全文

posted @ 2016-06-03 13:43 北门煎饼东门串儿 阅读(581) 评论(0) 推荐(0)

1009. 说反话 (20)
摘要:给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。 输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过80的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用1个空格分开,输入保证句子末尾没有多余的空格。 输出格式:每个测试用例的 阅读全文

posted @ 2016-06-02 20:03 北门煎饼东门串儿 阅读(128) 评论(0) 推荐(0)

1006. 换个格式输出整数 (15)
摘要:让我们用字母B来表示“百”、字母S表示“十”,用“12...n”来表示个位数字n(<10),换个格式来输出任一个不超过3位的正整数。例如234应该被输出为BBSSS1234,因为它有2个“百”、3个“十”、以及个位的4。 输入格式:每个测试输入包含1个测试用例,给出正整数n(<1000)。 输出格式 阅读全文

posted @ 2016-06-02 20:03 北门煎饼东门串儿 阅读(141) 评论(0) 推荐(0)

1007. 素数对猜想 (20)
摘要:让我们定义 dn 为:dn = pn+1 - pn,其中 pi 是第i个素数。显然有 d1=1 且对于n>1有 dn 是偶数。“素数对猜想”认为“存在无穷多对相邻且差为2的素数”。 现给定任意正整数N (< 105),请计算不超过N的满足猜想的素数对的个数。 输入格式:每个测试输入包含1个测试用例, 阅读全文

posted @ 2016-06-02 20:02 北门煎饼东门串儿 阅读(153) 评论(0) 推荐(0)

1005. 继续(3n+1)猜想 (25)
摘要:卡拉兹(Callatz)猜想已经在1001中给出了描述。在这个题目里,情况稍微有些复杂。 当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数。例如对n=3进行验证的时候,我们需要计算3、5、8、4、2、1,则当我们对n=5、8、4、2进行验证的时候,就可以直接判定卡拉兹 阅读全文

posted @ 2016-06-02 20:01 北门煎饼东门串儿 阅读(163) 评论(0) 推荐(0)

1004. 成绩排名 (20)
摘要:读入n名学生的姓名、学号、成绩,分别输出成绩最高和成绩最低学生的姓名和学号。 输入格式:每个测试输入包含1个测试用例,格式为 其中姓名和学号均为不超过10个字符的字符串,成绩为0到100之间的一个整数,这里保证在一组测试用例中没有两个学生的成绩是相同的。 输出格式:对每个测试用例输出2行,第1行是成 阅读全文

posted @ 2016-06-02 20:00 北门煎饼东门串儿 阅读(149) 评论(0) 推荐(0)

1002. 写出这个数 (20)
摘要:读入一个自然数n,计算其各位数字之和,用汉语拼音写出和的每一位数字。 输入格式:每个测试输入包含1个测试用例,即给出自然数n的值。这里保证n小于10100。 输出格式:在一行内输出n的各位数字之和的每一位,拼音数字间有1 空格,但一行中最后一个拼音数字后没有空格。 输入样例: 输出样例: 阅读全文

posted @ 2016-06-02 19:59 北门煎饼东门串儿 阅读(137) 评论(0) 推荐(0)

1001 害死人不偿命的(3n+1)猜想 (15)
摘要:卡拉兹(Callatz)猜想: 对任何一个自然数n,如果它是偶数,那么把它砍掉一半;如果它是奇数,那么把(3n+1)砍掉一半。这样一直反复砍下去,最后一定在某一步得到n=1。卡拉兹在1950年的世界数学家大会上公布了这个猜想,传说当时耶鲁大学师生齐动员,拼命想证明这个貌似很傻很天真的命题,结果闹得学 阅读全文

posted @ 2016-06-02 19:57 北门煎饼东门串儿 阅读(168) 评论(0) 推荐(0)

Java静态方法不具有多态性
摘要:动态绑定机制使得基类的引用能够指向正确的子类对象,从而使得面向基类编程成为可能。 然而动态绑定在以下两种情况会失效。 1、基类方法是private或final修饰的 这个很好理解,因为private说明该方法对子类是不可见的,子类再写一个同名的方法并不是对父类方法进行复写(Override),而是重 阅读全文

posted @ 2016-06-02 16:14 北门煎饼东门串儿 阅读(435) 评论(0) 推荐(0)

Java中浮点数的基础知识
摘要:偶然查看Math.round的JDK 注释说0x1.fffffep-2f是最接近0.5的float类型的小数,咦,科学计数法用e表示指数我是知道的,但是这个p是什么鬼。可能有的读者还会问,为什么这个数时最接近0.5的数,这个数到底是多少呢?所以现在的问题有两个: 1、p代表什么。 2、0x1.fff 阅读全文

posted @ 2016-06-01 20:39 北门煎饼东门串儿 阅读(1606) 评论(0) 推荐(0)

导航