read doubles faster in cpp

Правка en1, от dush1729, 2021-08-09 22:39:29

Just wanted to share this after watching many submissions for Ezzat and Two Subsequences TLEing because they used doubles.

Use

string s;
cin >> s;
double x = stod(s);

instead of

double x;
cin >> x;

Found this trick hidden in algo-lib template after we were wondering why https://codeforces.me/contest/1557/submission/125408355 is so fast even after using doubles.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский dush1729 2021-08-09 22:39:29 579 Initial revision (published)