为什么第6个点wa了??
查看原帖
为什么第6个点wa了??
757455
bj12z_zhangyongqi楼主2022/11/29 12:58
#include<bits/stdc++.h>
using namespace std;
int a,b,ans;
int sgn(int x){
	if (x > 0) return 1;
	else return -1;
}
int fun(int q,int w){
	if (q >= 0){
		ans = sgn(w) * q;
		return ans;
	}
	else{
		ans = sgn(w) * -1*q;
		return ans;
	}
}
int main(){
	cin>>a>>b;
	cout<<fun(a,b);
	return 0;
}
2022/11/29 12:58
加载中...