随笔分类 -  奇思妙想

摘要:Problem DescriptionDo you know Utopia? It's a perfect world in which everyone leads a happy life.A fairy wants to make a naive Utopia City. She studies the factors that have an impact on people's happiness and thinks that a person is happy if and only if all other persons' total "in 阅读全文
posted @ 2014-04-03 12:12 chen2013 阅读(338) 评论(0) 推荐(0)
摘要:DescriptionGiven a series of n numbers a1, a2, ..., an, the partial sum of the numbers is defined as the sum of ai, ai+1, ..., aj.You are supposed to calculate how many partial sums of a given series of numbers could be divided evenly by a given number m.InputThere are multiple test, each contains 2 阅读全文
posted @ 2014-03-12 16:30 chen2013 阅读(242) 评论(0) 推荐(0)
摘要:DescriptionAn arithmetic series consists of a sequence of terms such that each term minus its immediate predecessor gives the same result. For example, the sequence 3, 7, 11, 15 is the terms of the arithmetic series 3+7+11+15; each term minus its predecessor equals 4. (Of course there is no requirem 阅读全文
posted @ 2014-02-27 10:28 chen2013 阅读(309) 评论(0) 推荐(0)
摘要:DescriptionIt is always very nice to have little brothers or sisters. You can tease them, lock them in the bathroom or put red hot chili in their sandwiches. But there is also a time when all meanness comes back! As you know, in one month it is Christmas and this year you are honored to make the big 阅读全文
posted @ 2014-02-23 20:17 chen2013 阅读(311) 评论(0) 推荐(0)
摘要:DescriptionLet f(n) be the number of factors of integer n.Your task is to count the number of i(1 #define MAXN 1000001int f[MAXN]={0};int s[MAXN]={0};int c[MAXN]={0};int main(){ //先求出每个数的因子数 for(int i=1; i<MAXN; i++){ for(int j=1; i*j<MAXN; j++){ f[i*j]++; } } /... 阅读全文
posted @ 2014-02-23 10:52 chen2013 阅读(336) 评论(0) 推荐(0)
摘要:Problem Description Wangpeng has N clothes, M pants and K shoes so theoretically he can have N×M×K different combinations of dressing. One day he wears his pants Nike, shoes Adiwang to go to school happily. When he opens the door, his mom asks him to come back and switch the dressing. Mom 阅读全文
posted @ 2014-02-17 12:12 chen2013 阅读(274) 评论(0) 推荐(0)
摘要:描述 It is an interesting exercise to write a program to print out all permutations of 1, 2, …, n. However, since there are 6227020800 permutations of 1, 2, …, 13, it is unlikely that we would ever run this program on an input of size more than 10.However, here is another interesting problem whose sol 阅读全文
posted @ 2014-02-14 16:43 chen2013 阅读(226) 评论(0) 推荐(0)
摘要:描述Given a string of symbols, it’s natural to look it over and see what substrings are present. In this problem, you are given a string and asked to consider what substrings are absent. Of course, a given string has finite length and therefore only finitely many substrings, so there are always infini 阅读全文
posted @ 2014-02-12 15:37 chen2013 阅读(267) 评论(0) 推荐(0)
摘要:描述Fractions in octal (base 8) notation can be expressed exactly in decimal notation. For example, 0.75 in octal is 0.953125 (7/8 + 5/64) in decimal. All octal numbers of n digits to the right of the octal point can be expressed in no more than 3n decimal digits to the right of the decimal point. Wri 阅读全文
posted @ 2014-02-11 16:09 chen2013 阅读(251) 评论(0) 推荐(0)