- import java.util.Scanner;
- public class b893 {
- static long a,b,c,d,e,f;
- static boolean ans = false;
- public static void main(String[]args){
- Scanner input = new Scanner(System.in);
- while (input.hasNextInt()){
- a = input.nextLong();
- b = input.nextLong();
- c = input.nextLong();
- d = input.nextLong();
- e = input.nextLong();
- f = input.nextLong();
- if (number(-35)*number(35)==0){
- System.out.println("Too many... = =\"");
- break;
- }
- result(-35);
- if (!ans){
- System.out.println("N0THING! >\\\\\\<");
- }
- }
- }
- public static long number(int x){
- return (a*(long)Math.pow(x,5))+ (b*(long)Math.pow(x,4))+(c*(long)Math.pow(x,3))+(d*(long)Math.pow(x,2))+(e*x)+f;
- }
- public static void result (int x){
- if (number(x)==0){//檢查單個數字是不是根
- System.out.printf("%d %d\n",x,x);
- ans= true;
- }
- if (x >=35){
- return;
- }
- if (number(x)*number(x+1)<0){
- System.out.printf("%d %d\n",x,x+1);
- result (x+1);
- ans = true;
- } else {
- result(x+1);
- }
- }
- }
複製代碼 |