#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define pb push_back
#define pf push_front
#define all(v) (v).begin() , (v).end()
#define allr(v) (v).rbegin() , (v).rend()
#define fi first
#define se second
#define forn(i,x,n) for(ll i=x;i<n;i++)
#define forr(i,n,x) for(ll i=n;i>x;i--)
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ones(n) __builtin_popcountll(n)
#define sum(a) accumulate(a.begin(),a.end(),0ll)
#define str(a) to_string(a)
#define len(a) (ll)a.size()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
//template<class T> using order_set= tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
int main()
{
fast;
int n;
cin>>n;
forn(_,0,n)
{
ld temp,dist;
cin>>temp>>dist;
cout<<fixed<<setprecision(2)<<(dist * 1000.0) / (331.3 + .606 * temp)<<'\n';
}
}
It is about rounding, you have to set value = (dist * 1000.0) / (331.3 + .606 * temp), and then to round you have to floor(value*100+0.5)/100; Then it gets AC.
thank you, my code get accepted in python and c++ also.
This still gives me wrong answer. What am I doing wrong?
You don't use setprecision after rounding, due to it changing the answer. It gets AC when you remove fixed and setprecision(2).
Thank you :)
your code will be accepted if you print value without setprecision and fixed, but i don't know why these happened.