HDU 2149 Public Sale

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
	int m,n,flag,i;
	while (cin>>n>>m)
	{
		flag=1;
		if (n>m)
		{
			if (n%(m+1)==0)
			{
				cout<<"none"<<endl;
			}
			else
				cout<<n%(m+1)<<endl;
		}
		else
		{
		    for (i=n;i<=m;i++)
		    {
               if(!flag)  cout<<" ";
               cout<<i;
			   flag=0;
		    }
			cout<<endl;
		}
	}
	return 0;

}



#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;


int main()
{
    int N,M,T;
	int i,j;
	double cnt;
	int time;
	int mark[5001];

	while(cin>>N>>M){
		if(N%(M+1) == 0){
			cout<<"none"<<endl;
		}else{
			if(N > M){
                cout<<N%(M+1)<<endl;
			}
			else{
				for(i = N;i < M;i++){
					cout<<i<<" ";
				}
				cout<<i<<endl;
			}
		}
	}
	return 0;
}


你可能感兴趣的:(HDU 2149 Public Sale)