5 solutions

  • 4
    @ 2025-7-19 19:36:08
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long LL;
    int dx[]={-2,-2,-1,-1,1,1,2,2};
    int dy[]={-1,1,-2,2,-2,2,-1,1};
    int main()
    {
    	LL x1,y1,x2,y2;
    	cin>>x1>>y1>>x2>>y2;
    	int cnt=0;
    	for(int i=0;i<8;i++)
    	{
    		int a=x1+dx[i],b=y1+dy[i];
    		int dx=a-x2,dy=b-y2;
    		int s=dx*dx+dy*dy;
    		if(s==5)
    		{
    			cnt++;
    		}
    	}
    	if(cnt>0)
    	{
    		cout<<"Yes";
    	}
    	else
    	{
    		cout<<"No";
    	}
    	return 0;
    }
    
    • @ 2026-1-2 11:31:27

      变量名错了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    • @ 2026-1-2 11:31:51

      @ int dx=a-x2,dy=b-y2;

      确实,这错了
      
    • @ 2026-3-18 19:59:01

      @ 666

  • 1
    @ 2026-7-14 16:19:55

    //大家可以用这个画图
    
    • 1
      @ 2026-7-10 15:47:49
      #include<bits/stdc++.h>
      using namespace std;
      typedef long long LL;
      int dx[]={-2,-2,-1,-1,1,1,2,2};
      int dy[]={-1,1,-2,2,-2,2,-1,1};
      int main()
      {
      	LL x1,y1,x2,y2;
      	cin>>x1>>y1>>x2>>y2;
      	int cnt=0;
      	for(int i=0;i<8;i++)
      	{
      		int a=x1+dx[i],b=y1+dy[i];
      		int dx=a-x2,dy=b-y2;
      		int s=dx*dx+dy*dy;
      		if(s==5)
      		{
      			cnt++;
      		}
      	}
      	if(cnt>0)
      	{
      		cout<<"Yes";
      	}
      	else
      	{
      		cout<<"No";
      	}
      	return 0;
      }
      
      • 0
        @ 2026-7-22 9:36:56
        #include <bits/stdc++.h>
        using namespace std;
        typedef long long LL;
        int dx[]={-2,-2,-1,-1,1,1,2,2};
        int dy[]={-1,1,-2,2,-2,2,-1,1};
        int main()
        {
        	LL x1,y1,x2,y2;
        	cin>>x1>>y1>>x2>>y2;
        	int cnt=0;
        	for(int i=1;i<=8;i++)
        	{
        		int a=x1+dx[i],b=y1+dy[i];
        		int dx=a-x2,dy=b-y2;
        		int s=dx*dx+dy*dy;
        		if(s==5)
        		{
        			cnt++;
        		}
        	}
        	if(cnt>0)
        	{
        		cout<<"Yes";
        	}
        	else
        	{
        		cout<<"No";
        	}
        	return 0;
        }
        • -1
          @ 2026-6-27 9:44:09

          • 1

          Information

          ID
          2464
          Time
          1000ms
          Memory
          256MiB
          Difficulty
          1
          Tags
          # Submissions
          40
          Accepted
          19
          Uploaded By