Блог пользователя dush1729

Автор dush1729, история, 3 года назад, По-английски

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

  • Проголосовать: нравится
  • +59
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

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