65 条题解

  • -1
    @ 2023-8-7 10:22:54

    新手上路,请多关照!!

    #include <bits/stdc++.h> 
    using namespace std;
    int main()
    {
        int n;
        cin >> n;
        if(n == 1)
        {
            cout << "swim";
        }
        if(n == 3) 
        {
            cout << "program";
        }
        if(n == 5) 
        {
            cout << "read";
        }
        if(n == 6)
        {
            cout << "math";
        }
        if(n == 2 or n == 4 or n == 7)
        { 
            cout << "rest";
        }
        return 0;
    }
    
  • -1
    @ 2023-4-13 20:40:45

    C++

    #include <iostream>
    using namespace std;
    int main(int argc, char *argv[]`)
    {
        int playerinput;
        cin >> playerinput;
        if (n == 1) cout << "swim";
        if (n == 3) cout << "program";
        if (n == 5) cout << "read";
        if (n == 6) cout << "math";
        if (n == 2 or n == 4 or n == 7) cout << "rest";
        return 0
    }
    

    Pascal

    program Main;
    var
      playerinput: integer;
    begin
      readln(playerinput);
      if playerinput = 1 then writeln('swim')
      else if playerinput = 3 then writeln('program')
      else if playerinput = 5 then writeln('read')
      else if playerinput = 6 then writeln('math')
      else if (playerinput = 2) or (playerinput = 4) or (playerinput = 7) then writeln('rest');
    end
    

    Python

    playerinput = int(input())
    if playerinput == 1:
        print('swim')
    elif playerinput == 3:
        print('program')
    elif playerinput == 5:
        print('read')
    elif playerinput == 6:
        print('math')
    elif playerinput in [2, 4, 7]:
        print('rest')
    
    • -1
      @ 2022-8-25 18:45:05
      #include<iostream>
      using namespace std;
      int main()
      {
          int a;
          cin >> a;
          if (a == 1)
          {
              cout << "swim";
      
          }
          else
          {
              if (a == 3)
              {
                  cout << "program";
              }
              else
              {
                  if (a == 5)
                  {
                      cout << "read";
                  }
                  else
                  {
                       if (a == 6)
                      {
                          cout << "math";
                      }
                      else
                      {
                      cout << "rest";
                      }
                  }
              }
          }
      }
      
      • -1
        @ 2022-8-4 19:11:04

        这题可以简化一下大括号,如果if语句下面只有一句话,只需要写在后面即可,上代码!

        #include <bits/stdc++.h>
        using namespace std;
        int main()
        {
            int a;
            cin >> a;
            if ((a / 10) < 10 && a % 2 == 0 && a / 10 > 0)
                cout << "Yes";
            else
                cout << "No";
            return 0;
        }
        
        • -1
          @ 2022-7-7 12:56:08
          #include <iostream> 
          using namespace std; 
          int main() 
          { 
              int a; 
              cin >> a; 
              if (a == 1)
              { 
                  cout << "swim";
              }
              if (a == 3) 
              { 
              cout << "program";
              } 
              if (a == 5) 
              { 
                  cout << "read"; 
              } 
              if (a == 6) 
              {
                  cout << "math"; 
              } 
              else 
              { 
                  cout << "rest"; 
              } 
              return 0; 
          }
          ```</span>
          

          信息

          ID
          666
          时间
          1000ms
          内存
          64MiB
          难度
          4
          标签
          递交数
          8405
          已通过
          3903
          上传者