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

http://acm.hdu.edu.cn/showproblem.php?pid=2114 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 dig…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2114 自己对数论一窍不通啊现在,做了一道水题,贴出来吧...主要是让自己记住这个公式: 前n项和的立方公式为   : s(n)=(n*(n+1)/2)^2; 前n项和的平方公式为:s(n)=n*(n+1)(2*n+1)/6; 代码: #include<iostream> #include<cstdlib> #include<cstdio> using namespace s…
http://acm.hdu.edu.cn/showproblem.php?pid=2139 Problem Description You just need to calculate the sum of the formula: 1^2+3^2+5^2+……+ n ^2.   Input In each case, there is an odd positive integer n.   Output Print the sum. Make sure the sum will not e…
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) 看到这个时间,我懵逼了... 果然,Java就是打表,都不能AC,因为Java的输入是流,需要的时间比C真的长好多.... Problem Description You just need to calculate the sum of the formula: 1^2+3^2+5^2+--+ n ^2. Input In each…
Problem Description Calculate S(n). S(n)=1^3+2^3 +3^3 +--+n^3 . 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 Ou…
传送门 题意:从输入开始,1.输入样例数:2.然后输入一组样例中的行数n:3.前n-1行为定义变量(之间使用空格隔开),只需要map存进去就可以了(这里有覆盖的情况,故使用mp["s"] = "***"的方法赋值,因为insert的方法如果里面存在的话,插不进入数值):4.然后就是最后一行输入计算式子(之间使用空格隔开). 思路:我使用的字符流的方法分割的的字符串,因为题中说了使用空格隔开的: 变量的储存使用map就可以,在最后一行输入计算式子之后,同样使用字符流分…
u Calculate e Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 46844    Accepted Submission(s): 21489 Problem Description A simple mathematical formula for e is where n is allowed to go to infini…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1012 u Calculate e Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 52607    Accepted Submission(s): 24106 Problem Description A simple mathematical…
u Calculate e Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 28686    Accepted Submission(s): 12762 Problem Description A simple mathematical formula for e is where n is allowed to go to infini…
u Calculate e Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 35137 Accepted Submission(s): 15824 Problem Description A simple mathematical formula for e is where n is allowed to go to infinity. T…
题解:直接模拟 #include <cstdio> int main(){ puts("n e");puts("- -----------");puts("0 1"); double ans=1.0,f=1.0; for(int i=1;i<=9;i++){ if(i==1)printf("%d %.0lf\n",i,(ans+=(f/=(double)i))); else if(i==2)printf(&q…
Problem Description A simple mathematical formula for e is where n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively small values of n.   Output Output the approximations of e generated by the ab…
题解 代码 #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 1LL<<30; const int N = 10000000; int prime[N+5], low[N+5], check[N+5], pow_cnt[N+5], tot, f[N+5], f2[N+5], f3[N+5]; void sieve() { memset(check, 0, sizeof…
这是一道简单的数学计算问题   主义好输出格式就好 #include<stdio.h> int main() { printf("n e\n- -----------\n"); int a[10]; a[0]=1; for(int i=1;i<10;i++)  a[i]=a[i-1]*i; double e[10]; e[0]=1; for(int i=1;i<10;i++) { e[i]=e[i-1]+(double)1/a[i]; } for(int i=0…
分析:注意格式. #include<stdio.h> int main() { int i,j,k; double sum=0; printf("n e\n- -----------\n"); printf("0 1\n1 2\n2 2.5\n"); for(i=3;i<=9;i++) { k=1; for(j=1;j<=i;j++) k*=j; sum+=1.0/k; printf("%d %.9lf\n",i,sum+…
目录 @description@ @solution@ @accepted code@ @details@ @description@ 给定 A, B, C,求: \[\sum_{i=1}^{A}\sum_{j=1}^{B}\sum_{k=1}^{C}\phi(gcd(i, j^2, k^3))\mod 2^{30}\] Input 第一行给定一个整数 T,描述数据组数. 接下来每组数据包含三个整数 A, B, C,含义如上. 1 ≤ T ≤ 10, 0 < A, B, C ≤ 10^7 Out…
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029. 1032.1037.1040.1048.1056.1058.1061.1070.1076.1089.1090.1091.1092.1093. 1094.1095.1096.1097.1098.1106.1108.1157.116…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2838 Cow Sorting Problem Description Sherlock's N (1 ≤ N ≤ 100,000) cows are lined up to be milked in the evening. Each cow has a unique "grumpiness" level in the range 1...100,000. Since grumpy cow…
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-size: 10.5000pt } h1 { margin-top: 5.0000pt; margin-bottom: 5.0000pt; text-align: center; font-family: 宋体; color: rgb(26,92,200); font-weight: bold; fo…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602 Bone Collector Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 54132    Accepted Submission(s): 22670 Problem Description Many years ago , in…
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 1049 1050 1057 1062 1063 1064 1070 1073 1075 1082 1083 1084 1088 1106 1107 1113 1117 1119 1128 1129 1144 1148 1157 1161 1170 1172 1177 1197 1200 1201…
Lost's revenge Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 2262    Accepted Submission(s): 565 Problem Description Lost and AekdyCoin are friends. They always play "number game"(A bori…
测试样例之间输出空行,if(t>0) cout<<endl; 这样出最后一组测试样例之外,其它么每组测试样例之后都会输出一个空行. dp[i]表示以a[i]结尾的最大值,则:dp[i]=max(dp[i]+a[i],a[i]) 解释: 以a[i]结尾的最大值,要么是以a[i-1]为结尾的最大值+a[i],要么是a[i]自己本身,就是说,要么是连同之前的 构成一个多项的字串,要么自己单独作为一个字串,不会有其他的可能了. 状态规划的对状态的要求是:当前状态只与之前的状态有关,而且不影响下一…
Necklace/center> 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5727 Description SJX has 2*N magic gems. N of them have Yin energy inside while others have Yang energy. SJX wants to make a necklace with these magic gems for his beloved BHB. To avoid…
CRB and Tree Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2112    Accepted Submission(s): 635 Problem Description CRB has a tree, whose vertices are labeled by 1, 2, …, N. They are connected…
Picture Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4475    Accepted Submission(s): 2207 Problem Description A number of rectangular posters, photographs and other pictures of the same shap…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2274 Magic WisKey Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 568    Accepted Submission(s): 323 Problem Description On New Year Festival, Liu…
http://acm.hdu.edu.cn/showproblem.php?pid=2844 题意: 有n个硬币,知道其价值A1.....An.数量C1...Cn.问在1到m价值之间,最多能组成多少种价值. 思路: dp[i]表示i价值能够组成的最大种数. New~ 欢迎“热爱编程”的高考少年——报考杭州电子科技大学计算机学院关于2015年杭电ACM暑期集训队的选拔 Coins Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 327…
E - Largest Rectangle in a Histogram Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1506 Appoint description: Description A histogram is a polygon composed of a sequence of rectangles aligned a…
C - 最大连续子序列 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1231 Appoint description: Description 给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 <= i <= j <= K.最大连续子…