Problem Description
Calculate S(n).

S(n)=13+23 +33 +......+n3 .

 
Input
Each line will contain one integer N(1 < n < 1000000000). Process to end of file.
 
Output
For each case, output the last four dights of S(N) in one line.
 
Sample Input
1
2
 
Sample Output
0001
0009
 
  1. #include <stdio.h> // 运用数学公式:1^3 +2^3 +3^3 +……+n^3 =[n(n+1)/2]^2
  2.  
  3. int main(){
  4. int n;
  5. int result;
  6.  
  7. while(scanf("%d",&n)!=EOF){
  8. n=n%;
  9. result=(n*(n+)/)%;
  10. result=(result*result)%;
  11.  
  12. printf("%04d\n",result);
  13. }
  14.  
  15. return ;
  16. }

Calculate S(n)的更多相关文章

  1. [转] PHP计算两个坐标之间的距离, Calculate the Distance Between Two Points in PHP

    Calculate the Distance Between Two Points in PHP There are a lot of applications where it is useful ...

  2. CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved

    CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin ...

  3. maven -- 问题解决(二)解决“Could not calculate build plan”问题

    错误提示如下:(eclipse+maven) Could not calculate build plan: Failure to transfer org.apache.maven.plugins: ...

  4. 线段树 + 矩阵 --- ZOJ 3772 Calculate the Function

    Calculate the Function Problem's Link:   http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCod ...

  5. hdu 1012:u Calculate e(数学题,水题)

    u Calculate e Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tot ...

  6. Calculate its MTBF assuming 2000 FITS for each DRAM

    COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION A common unit of meas ...

  7. u Calculate e 分类: HDU 2015-06-19 22:18 14人阅读 评论(0) 收藏

    u Calculate e Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...

  8. How to calculate a good InnoDB log file size

    Peter wrote a post a while ago about choosing a good InnoDB log file size.  Not to pick on Peter, b ...

  9. Calculate the formula

    Problem Description You just need to calculate the sum of the formula: 1^2+3^2+5^2+……+ n ^2.   Input ...

  10. How to Calculate difference between two dates in C# z

    Do you need to find the difference in number of days, hours or even minute between the two date rang ...

随机推荐

  1. 基于.Net Core的API框架的搭建(4)

    6.加入日志功能 日志我们选用log4net,首先引入程序包: 选择2.0.8版本安装.然后在项目根目录新增log4net的配置文件log4net.config: <?xml version=& ...

  2. O - Combinations (组合数学)

    Description Computing the exact number of ways that N things can be taken M at a time can be a great ...

  3. 重新学习Java——Java基本的程序设计结构(一)

    最近在实验室看到各位学长忙于找工作的面试与笔试,深感自己的不足,决定重新好好学习一下<Java核心技术>这本书,曾经靠这本书走入Java的世界,但是也有很多的地方被我疏漏过去了,因此也是作 ...

  4. ubuntu+ngnix+thinkphp pathinfo配置

    一.thinkphp 项目改为pathinfo模式 XXX/ThinkPHP/Conf/convention.php文件中找到 'URL_MODEL' => 1, // URL访问模式,可选参数 ...

  5. c++中的类型转换--reinterpret_cast

    原文链接:  浅析c++中的类型转换--reinterpret_cast转换 reinterpret_cast作用为: 允许将任何指针转换为任何其他指针类型. 也允许将任何整数类型转换为任何指针类型以 ...

  6. RocketMQ学习笔记(14)----RocketMQ的去重策略

    1. Exactly Only Once (1). 发送消息阶段,不允许发送重复的消息 (2). 消费消息阶段,不允许消费重复的消息. 只有以上两个条件都满足情况下,才能认为消息是“Exactly O ...

  7. python安装外部模块Django

    Windows安装Django模块: 由于本人安装的Python版本是Python3.7,所以安装命令为:pip3 install django /pip3 install django安装过程中出现 ...

  8. Iframe用法精析

    String.prototype.match()中正则表达式的g标识存在的时候,函数不会捕获子表达式中的内容,不存在的时候可以. RegExp.prototype.exec()中g的存在只会影响,Re ...

  9. 魂酥的LNOI2019滚粗记

    $Day -???$ 高一下终于开始了 在开学文化课考试的水题之下混了个(成绩)前排 于是我便油然而生一种自信 我!要!进!省!队! 讲句真话我这么想的时候连自己都觉得自己是个十足的沙雕 我又不是zw ...

  10. Linux 服务器 U盘安装(避免U盘启动)以及拔除U盘后无法引导系统

    一.U盘制作 首先下载两个文件: ·         rhel-server-6.3-i386-boot.iso    启动镜像 ·         rhel-server-6.3-i386-dvd. ...