CodeForces 805A Fake NP

直觉。

一段区间中,肯定是$2$的倍数最多,因为区间长度除以$2$得到的数字最大。但只有$1$个数字的时候需要特判。

#include <cstdio>
#include <cmath>
#include <set>
#include <cstring>
#include <algorithm>
using namespace std;

int L,R;

int  main()
{
	while(~scanf("%d%d",&L,&R))
	{
		if(L==R) printf("%d\n",L);
		else printf("2\n");
	}
	return 0;
}

 

posted @ 2017-05-12 12:14  Fighting_Heart  阅读(174)  评论(0编辑  收藏  举报