2013
12-29

# An easy problem

We once did a lot of recursional problem . I think some of them is easy for you and some if hard for you.
Now there is a very easy problem . I think you can AC it.
We can define sum(n) as follow:
if i can be divided exactly by 3 sum(i) = sum(i-1) + i*i*i;else sum(i) = sum(i-1) + i;
Is it very easy ? Please begin to program to AC it..-_-

The input file contains multilple cases.
Every cases contain only ont line, every line contains a integer n (n<=100000).
when n is a negative indicate the end of file.

The input file contains multilple cases.
Every cases contain only ont line, every line contains a integer n (n<=100000).
when n is a negative indicate the end of file.

1
2
3
-1

1
3
30

2011-12-16 12:11:14

mark：直接打表。TLE了2次，就是不打表直接算的后果。

# include <stdio.h>

long long dp[100010] ;

int main ()
{
long long n, i ;
for (i = 1 ; i<= 100000 ; i++)
{
if (i%3==0) dp[i] = dp[i-1] + i*i*i ;
else dp[i] = dp[i-1]+i ;
}
while (~scanf ("%I64d", &n) && n>=0)
printf ("%I64d\n", dp[n]) ;
return 0 ;
}

1. “” title=”" “” /> 切，制作组又没有换，而且特么的也比第一季蹦来蹦去的好，第一季特么的都是群小屁孩在冒险，=- =而且第一季黑主角狂魔，都让人把纳兹当成挂王了

2. #include <stdio.h>
int main(void)
{
int arr[] = {10,20,30,40,50,60};
int *p=arr;
printf("%d,%d,",*p++,*++p);
printf("%d,%d,%d",*p,*p++,*++p);
return 0;
}

为什么是 20,20,50,40,50. 我觉得的应该是 20,20,40,40,50 . 谁能解释下？

3. 这道题目的核心一句话是：取还是不取。
如果当前取，则index+1作为参数。如果当前不取，则任用index作为参数。

4. 有两个重复的话结果是正确的，但解法不够严谨，后面重复的覆盖掉前面的，由于题目数据限制也比较严，所以能提交通过。已更新算法

5. 第2题，TCP不支持多播，多播和广播仅应用于UDP。所以B选项是不对的。第2题，TCP不支持多播，多播和广播仅应用于UDP。所以B选项是不对的。