A - Children and Candies (ABC Edit)

思路:计算1~n的和

#include <bits/stdc++.h>
using namespace std;
int n;
int main(){
    cin >> n;
    int res = 0;
    for(int i=1;i<=n;i++) res += i;
    cout << res << endl;
    return 0;
}

 

posted @ 2022-07-07 07:51  聊服一  阅读(24)  评论(0编辑  收藏  举报