vendredi 28 juillet 2017

Unexpected behavior(wrong answer) of program for very large inputs like 10^18. can anyone help me?

  #include<ctgmath>
    #include<iostream>
    using namespace std;
    int main()
    {
        long long int t;
        for(cin>>t;t--;)
     {
        long double n,y;
        cin>>n>>y;
        if(sqrtl(2*y+0.25)-0.5<=n)
            cout<<ceill(sqrtl(2*y+0.25)-0.5)<<endl;
        else
            cout<<-1<<endl;
    }

        return 0;
    }

http://ift.tt/2u5lJJK please see this results and find the fault in the code i am able to get 20/100.

Aucun commentaire:

Enregistrer un commentaire