标签:
#include<iostream> #include<cstdio> #include<cstring> #define MID(a,b) ((a + b) >> 1) using namespace std; int cnt[5001]; int main() { int n,a,b; cin >> n; memset(cnt,0,sizeof(cnt)); cnt[1] = 1; for(int i = 2; i < 5001; i++) { for(int j = 2; j <= i / 2; j++) if(i % j == 0) cnt[i]++; cnt[i] += 2; } for(int i = 0; i < n; i++) { cin >> a >> b; int max = 0,result; for(int j = a; j <= b; j++) { if(cnt[j] > max) { max = cnt[j]; result = j; } } cout << result << endl; } }
标签:
原文地址:http://www.cnblogs.com/yong-hua/p/4661186.html