hdu 2114 Calculate S(n) 数论(简单题)】的更多相关文章

题目链接: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=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=4627 题目大意:给定一个整数n(2 <= n <= 109),满足a+b=n并且[a,b]的最小公倍数最大. 分析:相当简单的的一道题,因为生病好久没做题目,杭电居然是要用__int64,用long long反而错误,为此,WA了无数遍 代码如下: # include<iostream> # include<cstdio> # include<cmath> us…
题目;http://acm.hdu.edu.cn/showproblem.php?pid=5455 题意就是找出所给字符串有多少个满足题目所给条件的子串,重复的也算,坑点是如果有c,f以外的字符也是不满足条件的,还有我被坑了的地方就是当输入很多f的时候,我尽然脑抽的 认为这是不满足条件的,注意这两点就行了,直接暴力 #include<cstdio> #include<cstring> using namespace std; int main() { int t,i,j,x,y,k…
Number Sequence Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 39408    Accepted Submission(s): 16269 Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1],…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1253 题目大意:在所给的时间能顺利离开城堡. #include <iostream> #include <cstdio> #include <queue> #include <cstring> using namespace std; ][][],visit[][][],a,b,c,T; ][]= {,,,,,-,,,,,-,,,,,-,,}; struct n…
题目 //BigInteger 和 BigDecimal 是在java.math包中已有的类,前者表示整数,后者表示浮点数 import java.io.*; import java.util.*; import java.math.*; public class Main { /** * @xqq */ public BigInteger an(BigInteger a, BigInteger b, int n) { if(n == 1) { return a; } for(int i = 2…
Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them: Yuta has a non-direct graph with n vertices and m edges. The length of each edge . Now…
Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 290    Accepted Submission(s): 60 Problem Description Alice was felling into a cave. She found a strange door with a number s…
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…