解一元二次方程式
ax^2+bx+c=0, x=?
herrDeng網內搜尋
自訂搜尋
Ads
2011年3月17日 星期四
訂閱:
張貼留言 (Atom)
熱門文章
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
先說明一下這是後知後覺的解答,所謂後知就是股票價格已知存在陣列(清單),當然就要用迴圈練習,雙迴圈暴力解需時O(n**2),當然不用,採python單一迴圈解答「最佳股票的買賣時機#LeetCode 121 Best Time to Buy and Sell Stock」,解...
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
你會用C的算子sizeof?
-
Python C++使用字串find迴圈速解Leetcode 2490 Circular Sentence C++ & Python都有字串的find,用法都類似 split=s.find(' ', split+1)能找到s從index=split+1開...
-
Python CPP heap priority queue速解L eetcode 2530. Maximal Score After Applying K Operations heap/priority queue是重要的資料結構,無論是C++的std::priority_q...
46 則留言:
import java.util.*;
class smile
{
public static void main(String [] argv)
throws Exception
{
Scanner input=new Scanner(System.in);
int a=input.nextInt();
int b=input.nextInt();
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
double d2 = Math.sqrt(d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<=0)
{
System.out.println(s+"<0");
return;
}
System.out.println(Math.sqrt((float)d));
System.out.println(d<8.);
System.out.println("x1="+x1+",x2="+x2);
}
}
import java.util.*;
class qq{
public static void main(String [] argv)
throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("please key a=");
int a=input.nextInt();
System.out.print("please key b=");
int b=input.nextInt();
System.out.print("please key c=");
int c=input.nextInt();
float d = b*b - 4*a*c;
String s ="判別式";
double d2 = Math.sqrt(d);
double x1 = (-b + d2) / (2*a);
double x2 = (-b - d2) / (2*a);
System.out.println(a+"x^2+"+b+"x+"+c+"=0"+s+"="+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
System.out.println(Math.sqrt((float)d));
System.out.println("x1="+x1+",x2="+x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main (String[] arg)
{
int a,b,c;
Scanner input = new Scanner(System.in);
System.out.println("輸入a");
a = input.nextInt();
System.out.println("輸入b");
b = input.nextInt();
System.out.println("輸入c");
c = input.nextInt();
float d = b*b - 4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+"=0"+s+"="+d);
if (d<0)
{
System.out.println(s+"<0");
return;
}
double k,m,n;
System.out.println(Math.sqrt((float)d));
k = Math.sqrt((float)d);
m = (-b+k)/(a*2);
n = (-b-k)/(a*2);
System.out.println("方程式解為"+m+"和"+n);
}
}
import java.util.*;
class qq
{
public static void main (String[]arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{System.out.println(s+"<0以後都不");
return;
}
System.out.println(Math.sqrt((float)d));
/* float d2=math.sqrt(d);
x1=(-b+d2)/(2*a);
x2=(-b-d2)/(2*a);
*/
}
}
import java.util.*;
class qq
{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if (d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main(String[]arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("");
int a,b,c;
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
double d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((double)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class qq
{
public static void main (String [] arg) throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+"="+d);
if (d<0)
{
System.out.println(s+"<0");
return;
}
System.out.println(Math.sqrt((float)d));
double d2=Math.sqrt(d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class qq
{
public static void main (String [] arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print ("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+"="+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
System.out.println(Math.sqrt((float)d));
double d2=Math.sqrt(d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class qq
{
public static void main (String[]arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{System.out.println(s+"<0以後都不");
return;
}
System.out.println(Math.sqrt((float)d));
/* float d2=math.sqrt(d);
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
*/
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main (String[]arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print ("a=");
a=input.nextInt();
System.out.print ("b=");
b=input.nextInt();
System.out.print ("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
System.out.println(Math.sqrt((float)d));
System.out.println(d!=25);
if(d<0)
{
System.out.println(s+"<0");
return;
}
System.out.println(Math.sqrt((float)d));
double d2=Math.sqrt(d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("a=");
int a=input.nextInt();
System.out.print("b=");
int b=input.nextInt();
System.out.print("c=");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main (String[]arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{System.out.println(s+"<0以後都不");
return;
}
System.out.println(Math.sqrt((float)d));
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main(String [] arg) throws Exception
{
int a, b, c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+"="+d);
if (d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main (String[]arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{System.out.println(s+"<0以後都不");
return;
}
System.out.println(Math.sqrt((float)d));
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main(String[]arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("");
int a,b,c;
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
double d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((double)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class qq
{
public static void main(String[]arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("");
int a,b,c;
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
double d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((double)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class qq
{
public static void main(String [] arg)throws Exception
{ int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b= input.nextInt();
System.out.print("c=");
c= input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{System.out.println(s+"<0");
return;
}
System.out.println(Math.sqrt((float)d));
double d2=Math.sqrt(d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1) ;
System.out.println(x2) ;
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main(String[] arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x"+c+s+d);
if (d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class qq
{
public static void main (String [] arg)
{
int a,b,c;
Scanner input =new Scanner (System.in);
System.out.print("輸入a=");
a= input.nextInt();
System.out.print("輸入b=");
b= input.nextInt();
System.out.print("輸入c=");
c= input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{
System.out.println(s+"<0");
return;
{
System.out.println(Math.sqrt((float)d));
double d2=Math.sqrt(d);
double x1=(-d+d2)/(2*a);
double x2=(-d-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
}
}
import java.util.*;
class qq
{
public static void main(String [] arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class qq
{
public static void main(String[]arg)throws Exception
{
int a,b,c;
Scanner input =new Scanner(System.in);
System.out.print("a=");
a= input.nextInt();
System.out.print("b=");
b= input.nextInt();
System.out.print("c=");
c= input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+"0"+s+"="+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sprt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class qq
{
public static void main(String[]arg)throws Exception
{
int a,b,c;
Scanner input =new Scanner(System.in);
System.out.print("a=");
a= input.nextInt();
System.out.print("b=");
b= input.nextInt();
System.out.print("c=");
c= input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+"0"+s+"="+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sprt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class qq
{
public static void main(String[]arg)throws Exception
{
int a,b,c;
Scanner input =new Scanner(System.in);
System.out.print("a=");
a= input.nextInt();
System.out.print("b=");
b= input.nextInt();
System.out.print("c=");
c= input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+"0"+s+"="+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class qq
{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java {
public static void main(String[]arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System .out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d>0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class qq{
public static void main(String[]arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
張貼留言