4 条题解

  • 2
    @ 2023-10-5 19:56:40

    简单,函数搞定!

    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int x,y;
        cin>>x>>y;
        int a=abs(x);
        int b=abs(y);
        if (a<=1 && b<=1) cout<<"yes";
        else cout<<"no";
        return 0;
    }
    
  • 1
    @ 2023-7-28 10:31:54
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int x,y;
        cin>>x>>y;
        int a=abs(x);
        int b=abs(y);
        if (a<=1 && b<=1)
        {
            cout<<"yes";
        }
        else
        {
            cout<<"no";
        }
        return 0;
    } 
    

    数学题就要从数学角度出发思考嘛!!

    • 1
      @ 2023-7-7 23:02:44

      太简单了,随便写点题解:

      在获取数据以后,只需要判断获取的x和y坐标是不是在1到-1之间就行

      #include <iostream>
      using namespace std;
      
      int main()
      {
          int x1 = -1,x2 = 1,y1 = -1,y2 = 1,x3,y3;
          cin >> x3 >> y3;
          if ((x1 <= x3) && (x3 <= x2) && (y1 <= y3) && (y3 <= y2))
              cout << "yes";
          else
              cout << "no";
          return 0;
      }
      
      • 1
        @ 2023-6-20 20:09:16
        #include <iostream>
         using namespace std;
        int main() 
        {
            int x, y;
         
            cin >> x >> y;
         
            if (x >= -1 && x <= 1 && y >= -1 && y<= 1) 
        	{
        	
        	    cout << "yes";
            
            }
            
            else 
        	{
        	
        	    cout << "no";
            
            }
            
            return 0;
        }
        
        • 1

        信息

        ID
        158
        时间
        1000ms
        内存
        128MiB
        难度
        1
        标签
        递交数
        172
        已通过
        119
        上传者