求助刚才比赛第一题 70pts
  • 板块灌水区
  • 楼主2c_s
  • 当前回复12
  • 已保存回复12
  • 发布时间2023/8/26 22:02
  • 上次更新2023/11/3 01:00:23
查看原帖
求助刚才比赛第一题 70pts
583186
2c_s楼主2023/8/26 22:02
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define pii pair<int,int>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define fi first
#define se second
using namespace std;
inline ll read(){
	ll k=0,flag=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')flag=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		k=(k<<1)+(k<<3)+(c^48);
		c=getchar();
	}
	return k*flag;
}
inline void print(ll x){
    if(x<0){
        putchar('-');
        x=-x;
    }
    ll y=10,len=1;
    while(y<=x){
        y=(y<<1)+(y<<3);
        len++;
    }
    while(len--){
        y/=10;
        putchar(x/y+48);
        x%=y;
    }
}
int a,b;
int main(){
	cin>>a>>b;
	if(a>b)swap(a,b);
	if(a==b){
		cout<<abs(a);
		return 0;
	}
	if(a==0&&b!=0){
		cout<<b;
		return 0;
	}
	if(b==0&&a!=0){
		cout<<abs(a);
		return 0;
	}
	if(a<=0&&b>=0){
		cout<<b+(b-a);
	}
	else if(a<=0&&b<=0)cout<<abs(a);
	else cout<<b;
	return 0;
}

为啥 70 分啊(要不然我就能280+名了)

2023/8/26 22:02
加载中...