Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
41133 | wujunyi | 求1+2+3+... | C++ | Accepted | 0 MS | 244 KB | 180 | 2024-02-19 15:11:08 |
#include <bits/stdc++.h> using namespace std; int re(int n){ if(n==1){ return 1; } return re(n-1)+n; } int main(){ int n; cin>>n; cout<<re(n); return 0; }