4 条题解

  • 0
    @ 2025-6-30 20:04:57

    3. 输出测试

    题意描述

    输入一个数字 nn ,输出 1 n1~n 的所有数字,每一个数字后均有一个空格。

    正确代码

    #include<bits/stdc++.h>//万能头文件(// 引入常用 C++ 标准库头文件:包含容器、算法、I/O等)
    #define ll long long // 定义 ll 为 long long 的别名,用于存储较大整数本程序中未使用)
    #define mod 998244353 // 定义常用取模数(本程序中未使用)
    #define eps 1e-7 // 定义浮点数精度 eps(本程序中未使用)
    using namespace std; // 使用 std 命名空间,简化后续调用
    int main(){
      int n;//定义一个int类型正整数n
      cin>>n;//输入n
      for(int i=1;i<=n;i++){//循环n次,并定义一个int类型变量i表示已经循环次数+1
        cout<<i<<" ";//输出int类型变量i的值和一个空格
      }//循环的结束
      return 0;//结束程序,返回0
    }
    
    • 0
      @ 2025-2-7 19:13:13
      #include<bits/stdc++.h>
      using namespace std;
      int n;
      int main()
      {
      	cin>>n;
      	for(int i=1;i<=n;i++) cout<<i<<" ";
      	return 0;
      }
      
      • 0
        @ 2024-8-12 20:25:20

        #include using namespace std; int main() { // freopen("a+b.in","r",stdin); // freopen("a+b.out","w",stdout); int n; cin>>n; for(int i=1;i<=n;i++) cout<<i<<" "; return 0; }

        • 0
          @ 2024-7-16 21:07:31
          #include <bits/stdc++.h>
          using namespace std;
          int main( ){
              int n;
              cin>>n;
              for(int i=1;i<=n;i++)
              cout<<i<<" ";
          }
          
          • 1

          信息

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