Hust oj 1196 Marshal's confusion II(公式)
来源:互联网 发布:好看的女装品牌 知乎 编辑:程序博客网 时间:2024/05/16 11:25
Marshal's confusion IITime Limit: 1000 MSMemory Limit: 65536 KTotal Submit: 258(95 users)Total Accepted: 84(76 users)Rating: Special Judge: NoDescriptionone day, Marshal want to show the answer :Calculate S(n).
S(n)=1^3+2^3 +3^3 +......+n^3 .InputEach line will contain one integer N(1 < n < 1000000000). Process to end of file.OutputFor each case, output the last four dights of S(N) in one line.Sample Input1
2Sample Output0001
S(n)=1^3+2^3 +3^3 +......+n^3 .InputEach line will contain one integer N(1 < n < 1000000000). Process to end of file.OutputFor each case, output the last four dights of S(N) in one line.Sample Input1
2Sample Output0001
0009
公式:S(n)=1^3+2^3 +3^3 +......+n^3=[n(n+1)/2]^2
#include<cstdio>#include<iostream>#include<cmath>using namespace std;typedef long long int ll;ll n;int main(){ while(~scanf("%lld",&n)) { n %= 10000; ll a = (n + 1)*n/2; printf("%04lld\n",a*a%10000); }}
0 0
- Hust oj 1196 Marshal's confusion II(公式)
- 哈理工OJ 1196 Marshal's confusion II(数学公式题)
- Hust oj 1521 Marshal's Confusion III(整数快速幂)
- HLG 1251 Marshal's Confusion III
- HRBUST 1251 Marshal's Confusion III 【快速幂】 (2013 3.13)
- 哈理工 1251 Marshal's Confusion III(太坑快速幂)
- HLG 1251 Marshal's Confusion III (快速幂)
- Hust oj 2019 n! problem II(大数阶乘)
- Hust oj 1189 区间最大值 II(线段树RMQ)
- Hust oj 1397 XianGe的游戏II(KMP)
- Hust oj 2084(大数)
- Yuna's confusion
- Hust oj 2038 联系网络(MST)
- Hust oj 2234 土豪银行(贪心)
- Hust oj 1143 泉水(dfs)
- Hust oj 2113 Count(Map)
- Hust oj 1305 多边形(数学)
- Hust oj 1677 一个函数(栈)
- OC和Swift的桥接
- OpenWrt 搭建OpenVPN Server
- JavaScript设计模式(一)单例模式、组合模式和外观模式
- ajaxFileUpload中的错误修正
- 搭建Hbase集群
- Hust oj 1196 Marshal's confusion II(公式)
- PHP 错误及异常处理
- 程序员的软实力武器-smart原则
- IT-java-jvm-gc
- Android 将照片存入相册中之后相册不显示该照片
- 用技术让生活变得更好
- Linux-环境变量
- Python学习1——基础、函数、高级特性
- 多行 EditText 的光标高度问题