1 条题解

  • 0
    @ 2027-5-9 10:37:44

    【例5.2】输出第二个整数

    解题思路

    按输入顺序读入三个整数,仅输出第二个。

    正确性说明

    变量 b 恰好保存第二个输入值。

    易错点

    不能把三个数都输出。

    复杂度

    本题规模固定,时间 O(1),额外空间 O(1)。

    参考代码(C++11)

    #include <bits/stdc++.h>
    using namespace std;
    
    int main() {
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        int a, b, c;
        cin >> a >> b >> c;
        cout << b << "\n";
        return 0;
    }
    
    • 1

    信息

    ID
    194
    时间
    1000ms
    内存
    64MiB
    难度
    入门
    标签
    递交数
    0
    已通过
    0
    上传者