首页
DreamJudge
院校信息
专业题库
模拟考试
机试真题
上岸课程
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
阿灿
2025年3月15日 03:00
求1到n的和 题解:
P1133
回复 0
|
赞 3
|
浏览 141
#include<bits/stdc++.h> using namespace std; int main(){ int n,i,ans; cin>>n; cout<<(1+n)*n/2<<endl; return 0; }
18919717626
2024年6月29日 19:08
求1到n的和 题解:
P1133
回复 0
|
赞 3
|
浏览 830
#include <iostream> using namespace std; typedef long long LL; int main(){ int n; LL ans = 0; cin >> n; for(int i = 1;i <= n;i ++){ ans += i; } cout << ans << endl; return 0; }
Candour
2024年4月21日 00:02
求1到n的和 (等差数列)题解:
P1133
回复 0
|
赞 3
|
浏览 692
#include<bits/stdc++.h> using namespace std; typedef long long LL; int n; LL ans; int main() { cin >> n; ans = n * (1 + n) / 2; cout << ans; return 0; }
小酒
2024年3月11日 15:50
求1到n的和 题解:
P1133
回复 0
|
赞 2
|
浏览 726
1133解题思路 #include <stdio.h> int main() { double n; scanf("%lf",&n); printf("%g",n*(n+1)/2); }
promising
2024年3月3日 20:43
求1到n的和 题解:
P1133
回复 0
|
赞 3
|
浏览 991
#include<stdio.h> int main() { int n; scanf("%d",&n); int sum=0; for(int i=1;i<=n;i++) { sum=sum+i; } &nbs...
928上岸梦校!
2023年8月6日 12:23
等差数列数学方法,常数时间复杂度
P1133
回复 0
|
赞 1
|
浏览 1.1k
C++参考代码如下: #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << (1 + n) * n / 2; return 0; }
tianyz
2023年7月27日 14:09
求1到n的和 题解:
P1133
回复 0
|
赞 0
|
浏览 789
#include<bits/stdc++.h> using namespace std; int n, res; int main() { cin >> n; for ( int i = 1; i <= n; i ++) res += i; cout << res ; return 0; }
猪蹄子全是肉
2023年5月4日 16:40
求1到n的和 题解:
P1133
回复 0
|
赞 2
|
浏览 1.2k
#include <iostream> #include <algorithm> #include <cmath> #include <cstring> using namespace std; int n, res; // 定义变量 int main(){ cin >> n; // 输入整数n // 计算1~n的和 for (int i = 1; i <= n; ++i) { ...
飞天老头
2023年4月7日 22:02
for循环模拟题意
P1133
回复 0
|
赞 2
|
浏览 2.2k
#include<stdio.h> int main() { int n; scanf("%d",&n); int i,sum=0; for(i=1;i<=n;i++) sum+=i; printf("%d\n",sum); return 0; }
落翼
2023年1月11日 17:23
python,等差数列求和公式
P1133
回复 0
|
赞 1
|
浏览 3.5k
n = int(input()) print(int((1+n)*n/2)) # 等差数列求和
1
2
题目
求1到n的和
题解数量
14
发布题解
在线答疑
热门题解
1
求1到n的和 题解:
2
求1到n的和 题解:
3
求1到n的和 题解:
4
求1到n的和 (等差数列)题解:
5
求N到1的和题解
6
求1到n的和 题解:
7
for循环模拟题意
8
求1到n的和 题解:
9
1133 1到n求和
10
等差数列数学方法,常数时间复杂度