_Adam's blog

By _Adam, history, 7 weeks ago, In English

void solve(){ ll a,b,c,d;cin>>a>>b>>c>>d; ll a1=a/b; ll c1=c/d; if(a1==c1){ cout<<0<<endl; } else if(a1%c1==0){ cout<<1<<endl; } else if(c1%a1==0){ cout<<1<<endl; } else cout<<2<<endl;


why I am getting TLE in this Program


  • Vote: I like it
  • -1
  • Vote: I do not like it

7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

because you have not check the condition, when a1==0 or c1==0.