1 条题解

  • 0
    @ 2025-4-12 22:03:04

    C :

    #include<stdio.h>
    int main()
    {
        int x;
        scanf("%d",&x);
        if(x<1) printf("%d\n",x);
        else if(x<10) printf("%d\n",2*x-1);
        else printf("%d\n",3*x-11);
        return 0;
    }
    
    

    C++ :

    #include<iostream>
    using namespace std;
    int main()
    {
      int x,y;
      cin>>x;
      if(x<1)
        y=x;
      else if(x<10)
        y=2*x-1;
        else
        y=3*x-11;
        cout<<y<<endl;
      return 0;
    }
    
    • 1

    C语言程序设计教程(第三版)课后习题5.5

    信息

    ID
    2695
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者