摘要:
Description平面上有n条直线,且无三线共点,问这些直线能有多少种不同交点数。比如,如果n=2,则可能的交点数量为0(平行)或者1(不平行)。 Input输入数据包含多个测试实例,每个测试实例占一行,每行包含一个正整数n(nint main(int argc, char *argv[]){ int dp[21][200]; for(int i=1; i=1; j--){ for(int k=0; k<=190; k++){ //设有j条边平行,那么就多出(i-j)*j个交点 if(dp[i-j][k]) dp[i][k+(i-j)*j]=1; } } }... 阅读全文
posted @ 2014-02-14 19:14
chen2013
阅读(309)
评论(1)
推荐(0)
摘要:
描述 Two companies cooperatively develop a project, but they don’t like working with one another. In order to keep the company together, they have decided that only one of them will work on each job. To keep things fair, the jobs need to be split so that both work the same amount. This is accomplished 阅读全文
posted @ 2014-02-14 16:45
chen2013
阅读(292)
评论(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
阅读(228)
评论(0)
推荐(0)
摘要:
描述 A palindrome is a number that reads the same whether you read it from left to right or from right to left. Here is a surprising fact. Suppose we start with a number n. We reverse the digits of n and add it to n. If this number is a palindrome we stop. Otherwise, we repeat the reversal and additio 阅读全文
posted @ 2014-02-14 16:36
chen2013
阅读(353)
评论(0)
推荐(0)

浙公网安备 33010602011771号