acgo题库
  • 首页
  • 题库
  • 题单
  • 竞赛
  • 讨论
  • 排行
  • 团队
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情题解(0)讨论(0)提交记录(89)
  • 题解 AC,低内存,低耗时(高级版)

    //Step 1:导入主文件及命名空间; #include <iostream> #include <vector> #include <sstream> using namespace std; int main(){ // Step 2: 读取输入; string input; getline(cin, input); // Step 3: 处理输入; istringstream iss(input); vector<int> scores; int score; while (iss >> score) { scores.push_back(score); } // Step 4: 提取最后一个元素; if (!scores.empty()) { // Step 5: 输出结果; cout << scores.back(); cout<<endl; } else { cout << "No scores provided"; cout<<endl; } return 0; }

    userId_undefined

    ด้้༺༒༻F76༺༒༻ด้้

    出道萌新
    38阅读
    5回复
    1点赞
  • 简易题解

    这道题直接疯狂读入,输出最后一个元素刚好符合我们滚动优化,直接出来。

    userId_undefined

    ‮

    24阅读
    0回复
    2点赞
  • 题解

    #include<bits/stdc++.h> using namespace std; int main(){ int a; while(cin>>a) cin>>a; cout<<a; return 0; }

    userId_undefined

    LS_YZY

    出道萌新模拟·模拟练习生时空双修者题解仙人倔强青铜数组·数组操作员
    3阅读
    0回复
    0点赞
首页