中间数(for)

#include<bits/stdc++.h>
using namespace std;
int main()
{
    
      
   long long a,b;
   cin>>a>>b;
   if(a==b||a-1==b||b-1==a||(a-b)>=100000||(b-a)>=100000)
   cout<<"NoNoNo"<<endl;
   else//999 1
   if(a<b&&b-a!=1)
   {
    
    for(;a<=b;a++)
   cout<<a<<" ";}
   else
   if(a>b&&a-b!=1)
   {
    
    for(;a>=b;b++)
   cout<<b<<" ";}
   return 0;
}

猜你喜欢

转载自blog.csdn.net/m0_52628784/article/details/110671487
今日推荐