import java.util.Scanner;
class Java2015 {
public static void main(String args[]) throws Exception {
int x = 0, y = 0, z = 0;
Scanner scanner = new Scanner(System.in);
Scanner a = new Scanner(System.in);
Scanner b = new Scanner(System.in);
Scanner c = new Scanner(System.in);
Scanner d = new Scanner(System.in);
Scanner e = new Scanner(System.in);
Scanner f = new Scanner(System.in);
System.out.println("請輸入最大值Z:");
z = scanner.nextInt();
System.out.println("請輸入方程式二元一次係數:");
int A = a.nextInt();
int B = b.nextInt();
int C = c.nextInt();
int D = d.nextInt();
int E = e.nextInt();
int F = f.nextInt();
while (y < z) {
y = A*x*x*x*x*x + B*x*x*x*x + C*x*x*x+D*x*x+E*x+F;
x++;
}
x=(x-2);
System.out.print("當x為:" + x);
System.out.print(" y:" + (A*x*x*x*x*x + B*x*x*x*x + C*x*x*x+D*x*x+E*x+F));
System.out.println(",符合y<Z");
}
}
2.第一行輸入最大值
第二行輸入二元一次方程式的係數(共6個)
如果覺得五次方太多可在係數前打0,看個人需要幾次方方程式
3.完成圖
4. 518外包程式連結:http://case.518.com.tw/casepage-detail-84377.html
沒有留言:
張貼留言