Skip to content

Instantly share code, notes, and snippets.

@Zetaeta
Created February 22, 2014 18:25
Show Gist options
  • Save Zetaeta/9159501 to your computer and use it in GitHub Desktop.
Save Zetaeta/9159501 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
void doTheThing();
int main() {
int C;
cin >> C;
for (int i=0; i<C; ++i) {
doTheThing();
}
}
void doTheThing() {
int a, b, c;
cin >> a >> b >> c;
int b4ac = (b * b) - (4 * a * c);
if (a == 0 && b == 0 && c == 0) {
cout << "Over 9000 solutions\n";
}
else if ((a == 0 && b == 0) || b4ac < 0) {
cout << "No solution\n";
}
else if (a == 0 || b4ac == 0) {
cout << "1 solution\n";
}
else {
cout << "2 solutions\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment