-
-
Save nsmaciej/9159914 to your computer and use it in GitHub Desktop.
s1.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#define each(_a, _b) for (_a = 0; _a < _b; ++_a) | |
bool dow(int a, int b, int c, int x) { | |
return 0 == a*(x*x) + b*x + c; | |
} | |
int work(void) { | |
int a, b, c, i, s; | |
scanf("%d %d %d", &a, &b, &c); | |
if (b*b < 4*a*c) return 0; | |
if (a==0 && b==0 && c==0) return 3; | |
if (a==0 && b==0) return 0; | |
if (c<0) return 2; | |
if (a < b && b < c) return 0; | |
return 1; | |
} | |
int main(void) { | |
int n, i, t; | |
scanf("%d", &n); | |
each (i, n) { | |
t = work(); | |
switch (t) { | |
case 0: puts("No solution"); | |
break; | |
case 1: puts("1 solution"); | |
break; | |
case 2: puts("2 solutions"); | |
break; | |
default: puts("Over 9000 solutions"); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment