At the moment, the length of the code is 127 characters without spaces, tabulation and newline characters. The task is to reduce the length of the code to at least 125 characters, so that it compiles with the compiler version c ++ 5.0.1.

#include <iostream> main() { int64_t i=-100,a,b,c,d; std::cin>>a>>b>>c>>d; for(; i<101; i++) if(a*i*i*i+b*i*i+c*i+d == 0) std::cout<<i<<" "; } 

Closed due to the fact that the essence of the question is incomprehensible to the participants by Vlad from Moscow , Abyx , user207618, user194374, Alex 2 Jan '17 at 7:16 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • condition in if can be shortened as if(!((a*i*i+b*i+c)*i+d)) - Flowneee
  • 3
    @Evgeniy What is this compiler, c ++ 5.0.1, and what does this program do? And why should someone reduce this code? - Vlad from Moscow

1 answer 1

First, the main function must have an int return type.

As for reducing the number of characters in the function body, for example, you can make such changes. True, I did not check how much it will reduce the total number of characters

 int64_t i = -101, a, b, c, d; ^^^^^ std::cin >> a >> b >> c >> d; while ( ++i < 101 ) !( i * i * ( a * i + b ) + c * i + d ) && std::cout << i << ' ';