题解 | #牛牛的单链表求和#

牛牛的单链表求和

https://www.nowcoder.com/practice/a674715b6b3845aca0d5009bc27380b5

#include <iostream>
#include <list>
#include <functional>
#include <algorithm>
#include <numeric>
using namespace std;

int main() {
    int a;
    cin >> a;
    list<int> lst;
    while (cin >> a) lst.push_back(a);
    long long i = 0;
    cout << accumulate(lst.begin(), lst.end(), i);
}
// 64 位输出请用 printf("%lld")

我很懒,来不及学那些东西了

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务