螺旋折线

2022-06-28 18:59:08 浏览数 (1)

本文最后更新于 1163 天前,其中的信息可能已经有所发展或是发生改变。

代码语言:javascript复制
#include<iostream>
using namespace std;
int main(){
	int x2,y2;
	while(cin>>x2>>y2){
	int q,len2=0;

	if(x2>0){
		if(y2>0){
			int MAX=0;
			if(x2>y2){
				MAX=x2;
			}else{
				MAX=y2;
			}
			q=MAX 1;
			for(int k=1;k<q;k  ){
				len2 =(k*2-1)*2;
				if(q==1){
					continue;
				}
				len2 =(k-1)*2*2;
			}
			len2 =(q-1);
			if(MAX==y2){
				len2 =x2;
			}else{
				len2 =q-1 q-1-y2;
			}
		}else{
			int MAX=0;
			if(x2>-y2){
				MAX=x2;
			}else{
				MAX=-y2;
			}
			q=MAX 1;
			for(int k=1;k<q;k  ){
				len2 =(k*2-1)*2;
				if(q==1){
					continue;
				}
				len2 =(k-1)*2*2;
			}
			len2 =(q-1)*3;
			if(MAX==x2){
				len2 =-y2;
			}else{
				len2 =-y2 MAX-11-x2;
			}
		}
	}else{
		if(y2>0){
			int MAX=0;
			if(-x2>y2){
				MAX=-x2;
			}else{
				MAX=y2;
			}
			q=MAX;
			cout<<"MAX"<<MAX<<endl;
			for(int k=1;k<=q;k  ){
				len2 =(k*2-1)*2;
				if(q==1){
					continue;
				}
				len2 =(k-1)*2*2;
			}
			cout<<"len1"<<len2<<endl;
			len2-=q;
			cout<<"len2"<<len2<<endl;
			
			if(MAX==-x2){
				len2 =y2;
				cout<<"len3"<<len2<<endl;
			}else{
				len2=len2 MAX MAX x2;
				cout<<"MAX1"<<MAX<<endl;
				cout<<"len4"<<len2<<endl;
			}
			cout<<"len5"<<len2<<endl;
		}else{
			int MAX=0;
			if(-x2>-y2){
				MAX=-x2;
			}else{
				MAX=-y2;
			}
			q=MAX;
			for(int k=1;k<=q;k  ){
				len2 =(k*2-1)*2;
				if(q==1){
					continue;
				}
				len2 =(k-1)*2*2;
			}
			len2-=q;
			if(MAX==-x2){
				len2-=-y2;
			}else{
				len2=len2-MAX 1-(MAX x2);
			}
		}
	}
	cout<<len2;
	}
	return 0;
}

Post Views: 206

0 人点赞