这道题测试数据好水!,这个代码都能拿90分!
#include <iostream>
using namespace std;
int num[10000005] ,maxn;
bool isprime(int n) {
if(n<=1)
return false;
if(n==2 || n==3)
return true;
if(n%2 == 0)
return false;
if(n%6!=1 && n%6!=5)
return false;
for(int j=3 ; j*j<=n ; j+=2) {
if(n%j == 0)
return false;
}
return true;
}
int main() {
int N,M;
int cnt=0;
cin >> N >> M;
int t=M;
while(t>1) {
++ cnt;
t >>= 1;
}
if((1<<cnt) >= N) {
cout << cnt;
return 0;
}
}
顺便提示一下TLE的大佬,在前面加上我这段代码