Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
64318 | 逸凡 | 求1+2+3+... | C++ | Accepted | 0 MS | 240 KB | 175 | 2025-04-20 10:03:15 |
#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); return 0; }