美文网首页
入门训练 序列求和

入门训练 序列求和

作者: HeoLis | 来源:发表于2019-03-16 16:04 被阅读0次

    http://lx.lanqiao.cn/problem.page?gpid=T2
    公式n*(n+1)/2

    #include<iostream>
    using namespace std;
    
    int main(){
        long long n;
        cin >> n;
        cout << fixed; // 不使用科学计数法 
        cout << n*(n+1)/2;
        
        return 0;
    }
    

    相关文章

      网友评论

          本文标题:入门训练 序列求和

          本文链接:https://www.haomeiwen.com/subject/kyssmqtx.html