dush1729's blog

By dush1729, history, 3 years ago, In English

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://mirror.codeforces.com/contest/1557/submission/125408355 is so fast even after using doubles.

  • Vote: I like it
  • +59
  • Vote: I do not like it

»
3 years ago, # |
  Vote: I like it +5 Vote: I do not like it

In this problem you can also read the input as int and then cast it to double.