Skip to content

Instantly share code, notes, and snippets.

@pjastr
Created March 9, 2023 11:01
Show Gist options
  • Select an option

  • Save pjastr/a5ee7d4da0e10892848180ac4eec9562 to your computer and use it in GitHub Desktop.

Select an option

Save pjastr/a5ee7d4da0e10892848180ac4eec9562 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
int x=0;
int max_x=0;
if (b<c)
{
int result = 5*x*x+a*x+b;
while(result <c)
{
max_x=x;
x++;
result = 5*x*x+a*x+b;
}
}
else
{
int result = 5*x*x+a*x+b;
while(result >=c)
{
max_x=x;
x++;
result = 5*x*x+a*x+b;
}
while(result <c)
{
max_x=x;
x++;
result = 5*x*x+a*x+b;
}
}
printf("Wynik: %d\n", max_x);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment