#596 div2 A. Forgetting Things

很迷惑

a+1=b
给出a和b的第一位
让你猜a和b的数
若无解就是-1

唯一的坑点在于一组数据

9 1
输出
9 10

#include<bits/stdc++.h>
using namespace std;
#define ll long long

inline ll read()
{
    ll X=0,w=1;
    char c=getchar();
    while(c<'0'||c>'9')
    {
        if (c=='-')
        {
            w=-1;
        }
        c=getchar();
    }
    while(c>='0'&&c<='9')
    {
        X=(X<<3)+(X<<1)+(c^48);
        c=getchar();
    }
    return X*w;
}

int main(){
	ll a,b;
	a=read();
	b=read();
	if(a==9&&b==1){
		printf("9 10");
		return 0; 
	}
	if(abs(a-b)>1){
		printf("-1\n");
	}else if(abs(a-b)==1){
		if(a<b){
			printf("%lld99 %lld00",a,b);
		}else {
			printf("-1\n");
		}
	}else {
		printf("%lld00 %lld01",a,b);
	}
	
	return 0;
}

```

自从上次厦门下来后
不敢用int了
再也不敢了

发布了61 篇原创文章 · 获赞 8 · 访问量 2454

猜你喜欢

转载自blog.csdn.net/weixin_43982216/article/details/102847197