fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. long int q;
  6. cin>>q;
  7. for(long int h=0;h<q;h++)
  8. {
  9. long long int k,n,a,b,m,l;
  10. cin>>k>>n>>a>>b;
  11. m = k;
  12. int f=0;
  13. if(b*n >= k)
  14. {
  15. cout<<"-1"<<endl;
  16. }
  17. else
  18. {
  19. for(long long int i=1;i<=n;++i)
  20. {
  21. m = m - a;
  22. //cout<<m<<" " ;
  23. //cout<<b*(n-i)<<" "<<endl;
  24. if(b*(n-i)<m)
  25. {
  26. //cout<<"yyyy"<<endl;
  27. continue;
  28. }
  29. else
  30. {
  31. f=1;
  32. cout<<i-1<<endl;
  33. break;
  34. }
  35. }
  36. if(f==0)
  37. {
  38. cout<<n<<endl;
  39. }
  40. }
  41. }
  42. }
Compilation error #stdin compilation error #stdout 0.02s 27624KB
stdin
6
12 5 4 2
17 5 4 3
11 5 2 1
25 5 15 1
10 5 2 1
20 20 2 1
compilation info
Traceback (most recent call last):
  File "/usr/lib/python3.5/py_compile.py", line 125, in compile
    _optimize=optimize)
  File "<frozen importlib._bootstrap_external>", line 735, in source_to_code
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "./prog.py", line 2
    using namespace std;
                  ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.5/py_compile.py", line 129, in compile
    raise py_exc
py_compile.PyCompileError:   File "./prog.py", line 2
    using namespace std;
                  ^
SyntaxError: invalid syntax

stdout
Standard output is empty