1 条题解

  • 0
    @ 2026-1-28 17:18:57
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        // [1] 定义变量存储输入的整数n,作为循环的上限
        int n;
        // [2] 读取输入的整数n
        cin >> n;
    
        // [3] 使用for循环遍历1到n的所有整数
        for(int i = 1; i <= n; i++){
            // [4] 输出当前数字并换行,每行显示一个数
            cout << i << endl;
        }
    
        return 0;
    }
    
    • 1

    信息

    ID
    37
    时间
    1000ms
    内存
    256MiB
    难度
    1
    标签
    递交数
    1
    已通过
    1
    上传者