题意
有一个 到 的整数 。
让我们输出一个介于 和 之间的整数,且与 不同。
解法
如果 ,可以输出 或 。
如果 ,可以输出 或 。
如果 ,可以输出 或 。
代码
#include <bits/stdc++.h>
using namespace std;
signed main(){
int x;
cin>>x;
if(x==1){
cout<<2;
}else if(x==2){
cout<<3;
}else{
cout<<2;
}
return 0;
}有一个 到 的整数 。
让我们输出一个介于 和 之间的整数,且与 不同。
如果 ,可以输出 或 。
如果 ,可以输出 或 。
如果 ,可以输出 或 。
#include <bits/stdc++.h>
using namespace std;
signed main(){
int x;
cin>>x;
if(x==1){
cout<<2;
}else if(x==2){
cout<<3;
}else{
cout<<2;
}
return 0;
}