Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
61075 | zhangweiran | 求1+2+3+... | C++ | 通过 | 0 MS | 252 KB | 170 | 2025-02-21 21:59:21 |
#include<bits/stdc++.h> using namespace std; int sum(int n){ if(n==1) return 1; else return n+sum(n-1); } int main(){ int x; cin>>x; cout<<sum(x); } //cout