Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
36442 | Jeremy | 求1+2+3+... | C++ | Accepted | 0 MS | 256 KB | 185 | 2024-01-13 14:32:39 |
#include<bits/stdc++.h> using namespace std; int a[500]; int f(int n){ if(n==1) return 1; return f(n-1)+n; } int main() { int n; cin>>n; cout<<f(n); return 0; }