Hi all,
This is regarding the following question that appeared in last long-challenge : ModularEquation
I read the editorial and I’m not aiming for original constraints at the moment, I want to run my own old code that i couldn’t execute during the contest for sub-task #2,
after reading the editorial, it seems like my approach for sub-task #2 was not wrong however my code is still not getting accepted.
My Code
#include<iostream>
#include<vector>
#include<cmath>
#define li long long int
using namespace std;
li getMin(li a, li b){
return (a<=b)?a:b;
}
int main()
{
int t;
cin>>t;
while(t--){
li n,m;
cin>>n>>m;
li ans=0;
for(li b=2; b <= min(m,n); b++){
li eq = m - m%b;
li T = getMin(sqrt(eq)+1, b);
for(li a=1; a < T; a++){
if(eq%a == 0){
//cout<<"("<<a<<","<<b<<"),";
ans++;
}
}
}
// b > m
for(li b=m+1; b<=n; b++){
ans += (b-1);
}
cout<<ans<<endl;
}
return 0;
}
you may also view my submission here
I’m unable to figure out why my code is not even working for testcase #1
whats wrong with the code ? why is it not working for subtask #1 and #2