Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
61075 | zhangweiran | 求1+2+3+... | C++ | Accepted | 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