P14495 [NCPC 2025] Arithmetic Adaptation
1. 题目分析
阅读理解题。
设
-
当
s\ge 0 时,输出1 和s-1 。 -
当
s<0 时,输出-1 和s+1 。
因为
但考虑情况不完整,当
2. 代码
#include<bits/stdc++.h>
using namespace std;
int main()
{
int s;
scanf("%d",&s);
if(s==1)printf("-1 2\n");
else if(s==-1)printf("1 -2\n");
else if(s>=0)printf("%d %d\n",1,s-1);
else printf("%d %d\n",-1,s+1);
return 0;
}