214 条题解
-
1122Ml LV 7 @ 2024-01-29 16:54:20
暴力<算法<=数学
#include<bits/stdc++.h> using namespace std; int main() { long long n;cin >> n; cout << n * (n + 1) * (2 * n + 1) / 6;}
-
12021-03-17 17:41:40@
#include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <vector> #include <deque> using namespace std; namespace dts { typedef long long ll; ll n; void main() { scanf("%lld",&n); printf("%lld\n",n*(n+1)*(2*n+1)/6); } }; int main() { dts::main(); }
-
02020-02-10 16:54:31@
#include<iostream> using namespace std; int main() { long long edge; cin>>edge; long long answer=0; for(long long i=1;i<=edge;i++ ) { answer+=i*i; } cout<<answer; }
-
02017-08-03 15:28:42@
醉人的题目,错了好几次:
1.出题人语文水平有问题吧,题目题意都说不清楚。2.n的范围根本不在32767,int报错,要用long long。
#include <bits/stdc++.h> using namespace std; int main() { //freopen("input.txt","r",stdin); long long n,sum; scanf("%lld",&n); sum=n*(n+1)*(2*n+1)/6; printf("%lld\n",sum); return 0; }
-
02012-08-07 10:52:45@
我怎么会想到用高精度做?!直到想到了int64我才摆脱这厄运
-
02012-07-27 20:40:52@
我去,n的范围不是小于32767吗。int n就错,long long n就对……
-
02010-04-15 18:45:51@
include
include
int num1;
int a=0;
int add(int x)
{
if(x>0)
{
a=a+x*x;
x=x-1;
add(x);
}
return(a);
}
main()
{
scanf("%d",&num1);
printf("%d",add(num1));
system("pause");
} -
02010-04-14 18:30:36@
数学学来干什么?还要累加平方?不用
var
n:real;
begin
read(n);
writeln(n*n*n/3+n*n/2+n/6:0:0);
end. -
02009-11-10 14:41:10@
令人愤怒的叙述,有话就好好说么,整得那么晦涩……
var
n,i,j:longint;
num:int64;
begin
readln(n);
for i:=1 to n do
num:=num+sqr(i);
writeln(num);
end. -
02009-11-08 20:53:49@
var
a:int64;
begin
readln(a);
writeln(a*(2*a+1)*(a+1)div 6);
end. -
02009-10-31 10:45:39@
var
s,j:int64; n,i:longint;
begin
readln(n);
for i:=1 to n do
begin
j:=i*i;
s:=s+j;
end; writeln(s);
end.
So easy -
02009-10-30 12:08:46@
var
s : int64;
i,n : longint ;
begin
readln(n);
s:=0;
for i := 1 to n do
s:=s+i*i;
writeln(s);
end.
农夫山泉-味道有点甜;
完全是water
递推公式: An=n*n+An-1 -
02009-10-25 15:22:16@
program p1307(input,output);
var n,i:longint;
zs:int64;
begin
readln(n);
for i:=1 to n do
zs:=zs+(n-i+1)*(n-i+1);
writeln(zs);
end.^_^so easy!!!
-
02009-10-25 11:17:13@
解释下。。。。。。没看懂
-
02009-10-22 16:12:13@
说实话...这题我真的没读懂............
-
02009-10-22 15:29:19@
水水水~~~~~~~
var
a,i:longint;
g:qword;
begin
readln(a);
for i:=1to a do begin
g:=g+i*i;
end;
writeln(g);
end. -
02009-10-07 13:12:24@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms -
02009-09-27 20:18:19@
刷水题有利身体健康 ^.^
-
02009-09-21 18:40:32@
var
n,m,i:int64;
begin
readln(n);
m:=0;
for i:=1 to n do
m:=m+i*i;
writeln(m);
end. -
02009-09-16 17:05:01@
调高精度调了半天。。。
我的通过率啊555555555~~~