#include <iostream>using namespace std;int n,sum=0;int f (int i){ if (i<=n){ sum+=i; f(i+1); }}int main(int argc, char** argv) { cin>>n; f(1); cout<<sum; return 0;}
其實用公式解應該是最快的XD