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

Автор gray9, 11 лет назад, По-английски

I am getting below run time error in Codeforces, though code works as expected in my local compiler. Time: 0 ms, memory: 0 KB Verdict: RUNTIME_ERROR

I submitted my code for http://codeforces.com/contest/317/problem/A

Code is below.


#include <iostream> using namespace std; int main(){ double a,b,n; cin >> a >> b >> n; int minop=0; while(true){ if((a >= n) || (b >= n)) break; else { if(a<=0 || b <=0) break; minop++; if(a>b) b=a+b; else a=a+b; } } if(minop==0) minop=-1; cout << minop; return 1; }

Unable to understand the error. Please suggest how to solve it.

Полный текст и комментарии »

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