编程介的小学生 2019-08-13 21:59 采纳率: 20.5%
浏览 167

An easy problem

Problem Description
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..-_-

Input
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.

Output
output the result sum(n).

Sample Input
1
2
3
-1

Sample Output
1
3
30

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
    • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序