herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
先說明一下這是後知後覺的解答,所謂後知就是股票價格已知存在陣列(清單),當然就要用迴圈練習,雙迴圈暴力解需時O(n**2),當然不用,採python單一迴圈解答「最佳股票的買賣時機#LeetCode 121 Best Time to Buy and Sell Stock」,解...
-
你會用C的算子sizeof?
-
XOR prefixsum CPP python解Leetcode 1829 Maximum XOR for Each Query 其實這裡考慮的是元素個數為2^maximumBit的交換群,運算子為XOR。 [Python code請進]
-
Python C++使用字串find迴圈速解Leetcode 2490 Circular Sentence C++ & Python都有字串的find,用法都類似 split=s.find(' ', split+1)能找到s從index=split+1開...
47 則留言:
import java.util.LinkedList; class Term { double coeff; int exp; public Term(double coeff,int exp) { this.coeff=coeff; this.exp=exp; } void print() { if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } } public class hw1 { public static void main(String[] args) { LinkedList f=new LinkedList(); Term [] ff={new Term(789,101),new Term(-5,2),new Term(19,0)}; for(int i=0;i
import java.util.LinkedList; class ex2 {double coeff;int exp;public ex2(double coeff,int exp){ this.coeff=coeff; this.exp=exp;} void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117{ public static void main(String[] args) { LinkedList<ex2> f=new LinkedList<ex2>(); ex2 a=new ex2(-5,7); f.addLast(a); ex2 b=new ex2(666,5); f.addLast(b); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); }System.out.println(); }
}
package p1;import java.util.LinkedList;class aaa{ double coeff; int exp; public aaa(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } }
public class ex2 {
public static void main(String[] args) {
aaa A = new aaa (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList<aaa> f = new LinkedList<aaa>(); f.addLast(A); aaa B = new aaa(-5,2); f.addLast(B); aaa C = new aaa(19,0); f.addLast(C); while (!f.isEmpty()){ aaa tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }
}
package p1;
import java.util.*;
class t{ double coeff; int exp; public t(double coeff,int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class text2 {
public static void main(String[] args) { t a=new t(789,101); System.out.print("f(x)="); a.print(); System.out.println(); LinkedList<t> f=new LinkedList<t>(); f.addLast(a); t b=new t(-5,2); f.addLast(b); t c=new t(19,0); f.addLast(c); while(!f.isEmpty()){ t tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();}}
import java.util.LinkedList;
class Term{
double coeff;
int exp;
public Term(double coeff, int exp){
this.coeff = coeff;
this.exp = exp;
}
void print(){
if(coeff>0)
System.out.print("+"+coeff);
else
System.out.print(coeff);
System.out.print("x^"+exp);
}
}
public class ex1
{
public static void main(String[] args)
{
Term a=new Term(5,7);
a.print();
System.out.println();
LinkedList f=new LinkedList();
f.addLast(a);
Term b=new Term(666,5);
f.addLast(b);
while(!f.isEmpty()){
Term tmp=f.getFirst();
tmp.print();
f.removeFirst();
}
System.out.print();
}
}
import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117 { public static void main(String[] args) { LinkedList<Term> f=new LinkedList(); Term [] ff={new Term(789,101), new Term(-5,2),new Term(19,0)}; for(int i=0; i<ff.length; i++) f.addLast(ff[i]); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); } System.out.println(); }}
package p1;import java.util.LinkedList;class ABCD{ double coeff; int exp; public ABCD(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } }
public class ex2 {
public static void main(String[] args) {
ABCD A = new ABCD (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList<ABCD> f = new LinkedList<ABCD>(); f.addLast(A); ABCD B = new ABCD(-5,2); f.addLast(B); ABCD C = new ABCD(19,0); f.addLast(C); while (!f.isEmpty()){ ABCD tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }
}
import java.util.LinkedList;
class Term{ double coeff; int exp; public Term(double coeff, int exp){ this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1 {
public static void main(String[] args) { Term a=new Term(5,7); a.print(); System.out.println(); LinkedList<Term> f=new LinkedList<Term>(); f.addLast(a); Term b=new Term(666,5); f.addLast(b); while(!f.isEmpty()){ Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.print(); }
}
import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff, int exp){ this.coeff =coeff; this.exp = exp;}void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp);}}public class ex1 {
public static void main(String[] args) { Term a = new Term(-5, 7); a.print();System.out.println();LinkedList<Term> f=new LinkedList<Term>();f.addLast(a);Term b=new Term(666, 5);f.addLast(b);while(!f.isEmpty()){ Term tmp = f.getFirst(); tmp.print(); f.removeFirst();}System.out.println();} }
mport java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff,int exp){ this.coeff =coeff; this.exp = exp;}void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp);}}public class ex1 { public static void main(String[] args){ Term a = new Term(-5, 7); a.print();System.out.println();LinkedList<Term> f=new LinkedList<Term>();f.addLast(a);Term b=new Term(666,5);f.addLast(b);while(!f.isEmpty()){ Term tmp = f.getFirst(); tmp.print(); f.removeFirst();}System.out.println();}}
package p1;import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class test1 { public static void main(String[] args) { LinkedList<Term> f=new LinkedList(); Term [] ff={new Term(789,101),new Term(-5,2),new Term(19,0)}; for(int i=0;i<ff.length;i++) f.addLast(ff[i]); while(!f.isEmpty()) { f.getFirst().print(); f.removeFirst(); } System.out.println(); }
}
package p1;
import java.util.LinkedList;
class ddd { double coeff; int exp; public ddd(double coeff, int exp){ this.coeff= coeff; this.exp = exp; } void print(){ System.out.print("+"+coeff); System.out.print("x^"+exp); }}public class hw2 {
public static void main(String[] args) { ddd a=new ddd (789,101); a.print(); System.out.println(); LinkedList<ddd> f=new LinkedList<ddd>(); f.addLast(a); ddd b=new ddd(666,5); f.addLast(b); while(!f.isEmpty()){ ddd tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }
}
package www;import java.util.LinkedList;class Term{double coeff;int exp; public Term(double coeff,int exp) { this.coeff = coeff; this.exp = exp; } void print() { if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class w{ public static void main(String[] args) {LinkedList<Term> f=new LinkedList<Term>();Term[] ff={new Term(789,101),new Term(-5,2),new Term(19,0)};for(int i=0;i<ff.length; i++) f.addLast(ff[i]); while(!f.isEmpty()) { f.getFirst().print(); f.removeFirst(); } System.out.println(); }}
import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff, int exp) { this.coeff=coeff; this.exp=exp; } void print() { if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex6{ public static void main(String[] args) { LinkedList<Term> f=new LinkedList(); Term [] ff={new Term(789,101),new Term(-5,2),new Term(19,0)}; for (int i=0 ; i<ff.length;i++) { f.addLast(ff[i]); while(!f.isEmpty()) { f.getLast().print(); f.removeFirst(); } }System.out.println(); }
}
package hw1;import java.util.*;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class p1 {
public static void main(String[] args) { Term a=new Term(789,101); System.out.println("f(x)="); a.print(); System.out.println(); LinkedList<Term> f=new LinkedList<Term>(); f.addLast(a); Term b=new Term(-5,2); f.addLast(b); Term c=new Term(19,0); f.addLast(c); while(!f.isEmpty()) { Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();
}
}
package hw1;import java.util.*;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class p1 {
public static void main(String[] args) { Term a=new Term(789,101); System.out.println("f(x)="); a.print(); System.out.println(); LinkedList<Term> f=new LinkedList<Term>(); f.addLast(a); Term b=new Term(-5,2); f.addLast(b); Term c=new Term(19,0); f.addLast(c); while(!f.isEmpty()) { Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();
}
}
import java.util.LinkedList; class Term{ double coeff; int exp; public Term(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } } public class ex1117 { public static void main(String[] args) { LinkedList<Term> f=new LinkedList(); Term [] ff={new Term(789,101), new Term(-5,2),new Term(19,0)}; for(int i=0; i<ff.length; i++) f.addLast(ff[i]); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); } System.out.println(); } }
package 新增資料夾;
import java.util.LinkedList;
class i{ double coeff; int exp; public i(double coeff,int exp) { this.coeff= coeff; this.exp=exp; } void print() { System.out.print("+"+coeff); System.out.print("x^"+exp); }}public class p2 {
public static void main(String[] args) { i a=new i(789,101); System.out.print("f(x)="); a.print(); System.out.println(); LinkedList<i> f=new LinkedList<i>(); f.addLast(a); i e=new i(-5,2); f.addLast(e); i b=new i(19,0); f.addLast(b); while(!f.isEmpty()){ i tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }
}
import java.util.*;class x{ double coeff; int exp; public x(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class text2 {
public static void main(String[] args) { x f=new x(789,101); f.print(); System.out.println(); LinkedList<x> y=new LinkedList<x>(); y.addLast(f); x z=new x(-5,2); y.addLast(z); x a=new x(19,0); y.addLast(a); while(!y.isEmpty()){ x tmp=y.getFirst(); tmp.print(); y.removeFirst(); } System.out.println(); }
}
package p1;import java.util.LinkedList;class ABCD{ double coeff; int exp; public ABCD(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } }
public class ex2 {
public static void main(String[] args) {
ABCD A = new ABCD (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList<ABCD> f = new LinkedList<ABCD>(); f.addLast(A); ABCD B = new ABCD(-5,2); f.addLast(B); ABCD C = new ABCD(19,0); f.addLast(C); while (!f.isEmpty()){ ABCD tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }
}
import java.util.LinkedList;class Here { double coeff; int exp; public Here(double coeff,int exp){ this.coeff=coeff; this.exp=exp; } void print(){ System.out.print("+"+coeff); System.out.print("x"+exp); }}public class test2 { public static void main(String[] args) { Here a=new Here(789,101); a.print(); System.out.println(); { LinkedList<Here> f=new LinkedList<Here>(); f.addLast(a); Here b=new Here(-5,2); f.addLast(b); Here c=new Here(19,0); f.addLast(c); while(!f.isEmpty()){ Here tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); } }}
package hello;import java.util.*;
class T{ double coeff; int exp; public T(double coeff,int exp) { this.coeff=coeff; this.exp=exp; } void print() { if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}
public class hw2 {
public static void main(String[] args) { T a=new T(789,101); System.out.print("f(x)="); a.print(); System.out.println(); LinkedList<T> f=new LinkedList<T>(); f.addLast(a); T b=new T(-5,2); f.addLast(b); T c=new T(19,0); f.addLast(c); while(!f.isEmpty()) { T tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }
}
package p1;
import java.util.LinkedList;
class ABCD{
double coeff;
int exp;
public ABCD(double coeff, int exp){
this.coeff=coeff;
this.exp=exp;
}
void print(){
if (coeff>0)
System.out.print("+"+coeff);
else
System.out.print(coeff);
System.out.print("x^"+exp);
}
}
public class ex2 {
public static void main(String[] args) {
ABCD A = new ABCD (789,101);
System.out.print("f(x)=");
A.print();
System.out.println();
LinkedList f = new LinkedList();
f.addLast(A);
ABCD B = new ABCD(-5,2);
f.addLast(B);
ABCD C = new ABCD(19,0);
f.addLast(C);
while (!f.isEmpty()){
ABCD tmp=f.getFirst();
tmp.print();
f.removeFirst();
}
System.out.println();
}
}
package asdf;import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff=coeff; this.exp=exp; } void print() { System.out.print("+"+coeff); System.out.print("x^"+exp); }}
public class zxcv {
public static void main(String[] args) { Term a=new Term(789,101); System.out.print("f(x)="); a.print(); System.out.println(); LinkedList<Term> f=new LinkedList<Term>(); f.addLast(a); Term e=new Term(-5,2); f.addLast(e); Term b=new Term(-5,2); f.addLast(b); while(!f.isEmpty()){ Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }}
package hw1;import java.util.*;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class p1 {
public static void main(String[] args) { Term a=new Term(789,101); System.out.println("f(x)="); a.print(); System.out.println(); LinkedList f=new LinkedList(); f.addLast(a); Term b=new Term(-5,2); f.addLast(b); Term c=new Term(19,0); f.addLast(c); while(!f.isEmpty()) { Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();
}
}
package hw1;import java.util.*;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class p1 {
public static void main(String[] args) { Term a=new Term(789,101); System.out.println("f(x)="); a.print(); System.out.println(); LinkedList f=new LinkedList(); f.addLast(a); Term b=new Term(-5,2); f.addLast(b); Term c=new Term(19,0); f.addLast(c); while(!f.isEmpty()) { Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();
}
}
package hw1;import java.util.*;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class p1 {
public static void main(String[] args) { Term a=new Term(789,101); System.out.println("f(x)="); a.print(); System.out.println(); LinkedList f=new LinkedList(); f.addLast(a); Term b=new Term(-5,2); f.addLast(b); Term c=new Term(19,0); f.addLast(c); while(!f.isEmpty()) { Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();
}
}
B10333069 李宜謙
import java.util.LinkedList;
class Term{
double coeff;
int exp;
public Term(double coeff, int exp){
this.coeff = coeff;
this.exp = exp;
}
void print(){
if(coeff>0)
System.out.print("+"+coeff);
else
System.out.print(coeff);
System.out.print("x^"+exp);
}
}
public class ex1
{
public static void main(String[] args)
{
Term a=new Term(5,7);
a.print();
System.out.println();
LinkedList f=new LinkedList();
f.addLast(a);
Term b=new Term(666,5);
f.addLast(b);
while(!f.isEmpty()){
Term tmp=f.getFirst();
tmp.print();
f.removeFirst();
}
System.out.print();
}
}
package asdf;import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff=coeff; this.exp=exp; } void print() { System.out.print("+"+coeff); System.out.print("x^"+exp); }}
public class zxcv {
public static void main(String[] args) { Term a=new Term(789,101); System.out.print("f(x)="); a.print(); System.out.println(); LinkedList f=new LinkedList(); f.addLast(a); Term e=new Term(-5,2); f.addLast(e); Term b=new Term(-5,2); f.addLast(b); while(!f.isEmpty()){ Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }}
package p1;
import java.util.*;
class t{ double coeff; int exp; public t(double coeff,int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class text2 {
public static void main(String[] args) { t a=new t(789,101); System.out.print("f(x)="); a.print(); System.out.println(); LinkedList f=new LinkedList(); f.addLast(a); t b=new t(-5,2); f.addLast(b); t c=new t(19,0); f.addLast(c); while(!f.isEmpty()){ t tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();}}
package hw1;import java.util.*;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class p1 {
public static void main(String[] args) { Term a=new Term(789,101); System.out.println("f(x)="); a.print(); System.out.println(); LinkedList f=new LinkedList(); f.addLast(a); Term b=new Term(-5,2); f.addLast(b); Term c=new Term(19,0); f.addLast(c); while(!f.isEmpty()) { Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println();
}
}
package asdf;import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff,int exp) { this.coeff=coeff; this.exp=exp; } void print() { System.out.print("+"+coeff); System.out.print("x^"+exp); }}
public class zxcv {
public static void main(String[] args) { Term a=new Term(789,101); System.out.print("f(x)="); a.print(); System.out.println(); LinkedList f=new LinkedList(); f.addLast(a); Term e=new Term(-5,2); f.addLast(e); Term b=new Term(-5,2); f.addLast(b); while(!f.isEmpty()){ Term tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }}
package p1;import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class test1 { public static void main(String[] args) { LinkedList f=new LinkedList(); Term [] ff={new Term(789,101),new Term(-5,2),new Term(19,0)}; for(int i=0;i<ff.length;i++) f.addLast(ff[i]); while(!f.isEmpty()) { f.getFirst().print(); f.removeFirst(); } System.out.println(); }
}
mport java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117 { public static void main(String[] args) { LinkedList<Term> f=new LinkedList(); Term [] ff={new Term(789,101), new Term(-5,2),new Term(19,0)}; for(int i=0; i<ff.length; i++) f.addLast(ff[i]); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); } System.out.println(); }}
package p1;import java.util.LinkedList;class aaa{ double coeff; int exp; public aaa(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } }
public class ex2 {
public static void main(String[] args) {
aaa A = new aaa (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList f = new LinkedList(); f.addLast(A); aaa B = new aaa(-5,2); f.addLast(B); aaa C = new aaa(19,0); f.addLast(C); while (!f.isEmpty()){ aaa tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }
}
package p1;import java.util.LinkedList;class aaa{ double coeff; int exp; public aaa(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } }
public class ex2 {
public static void main(String[] args) {
aaa A = new aaa (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList f = new LinkedList(); f.addLast(A); aaa B = new aaa(-5,2); f.addLast(B); aaa C = new aaa(19,0); f.addLast(C); while (!f.isEmpty()){ aaa tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }
}
import java.util.LinkedList; class ex2 {double coeff;int exp;public ex2(double coeff,int exp){ this.coeff=coeff; this.exp=exp;} void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117{ public static void main(String[] args) { LinkedList f=new LinkedList(); ex2 a=new ex2(-5,7); f.addLast(a); ex2 b=new ex2(666,5); f.addLast(b); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); }System.out.println(); }
}
import java.util.LinkedList; class ex2 {double coeff;int exp;public ex2(double coeff,int exp){ this.coeff=coeff; this.exp=exp;} void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117{ public static void main(String[] args) { LinkedList f=new LinkedList(); ex2 a=new ex2(-5,7); f.addLast(a); ex2 b=new ex2(666,5); f.addLast(b); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); }System.out.println(); }
}
import java.util.LinkedList; class ex2 {double coeff;int exp;public ex2(double coeff,int exp){ this.coeff=coeff; this.exp=exp;} void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117{ public static void main(String[] args) { LinkedList f=new LinkedList(); ex2 a=new ex2(-5,7); f.addLast(a); ex2 b=new ex2(666,5); f.addLast(b); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); }System.out.println(); }
}
import java.util.LinkedList; class ex2 {double coeff;int exp;public ex2(double coeff,int exp){ this.coeff=coeff; this.exp=exp;} void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117{ public static void main(String[] args) { LinkedList f=new LinkedList(); ex2 a=new ex2(-5,7); f.addLast(a); ex2 b=new ex2(666,5); f.addLast(b); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); }System.out.println(); }
}
package p1;import java.util.LinkedList;class aaa{ double coeff; int exp; public aaa(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } }
public class ex2 {
public static void main(String[] args) {
aaa A = new aaa (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList f = new LinkedList(); f.addLast(A); aaa B = new aaa(-5,2); f.addLast(B); aaa C = new aaa(19,0); f.addLast(C); while (!f.isEmpty()){ aaa tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }
}
package b10333093;import java.util.LinkedList;class aaa{ double coeff; int exp; public aaa(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } } public class ex3 { public static void main(String[] args) { aaa A = new aaa (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList f = new LinkedList(); f.addLast(A); aaa B = new aaa(-5,2); f.addLast(B); aaa C = new aaa(19,0); f.addLast(C); while (!f.isEmpty()){ aaa tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); } }
import java.util.LinkedList; class ex2 {double coeff;int exp;public ex2(double coeff,int exp){ this.coeff=coeff; this.exp=exp;} void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class ex1117{ public static void main(String[] args) { LinkedList f=new LinkedList(); ex2 a=new ex2(-5,7); f.addLast(a); ex2 b=new ex2(666,5); f.addLast(b); while(!f.isEmpty()){ f.getFirst().print(); f.removeFirst(); }System.out.println(); }
}
package p1;import java.util.LinkedList;class Term{ double coeff; int exp; public Term(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if(coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class test1 { public static void main(String[] args) { LinkedList f=new LinkedList(); Term [] ff={new Term(789,101),new Term(-5,2),new Term(19,0)}; for(int i=0;i<ff.length;i++) f.addLast(ff[i]); while(!f.isEmpty()) { f.getFirst().print(); f.removeFirst(); } System.out.println(); }
}
mport java.util.*;class x{ double coeff; int exp; public x(double coeff, int exp) { this.coeff = coeff; this.exp = exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); }}public class text2 {
public static void main(String[] args) { x f=new x(789,101); f.print(); System.out.println(); LinkedList<x> y=new LinkedList<x>(); y.addLast(f); x z=new x(-5,2); y.addLast(z); x a=new x(19,0); y.addLast(a); while(!y.isEmpty()){ x tmp=y.getFirst(); tmp.print(); y.removeFirst(); } System.out.println(); }
}
import java.util.LinkedList;
class Term{
double coeff;
int exp;
public Term(double coeff, int exp){
this.coeff = coeff;
this.exp = exp;
}
void print(){
if(coeff>0)
System.out.print("+"+coeff);
else
System.out.print(coeff);
System.out.print("x^"+exp);
}
}
public class ex1
{
public static void main(String[] args)
{
Term a=new Term(5,7);
a.print();
System.out.println();
LinkedList f=new LinkedList();
f.addLast(a);
Term b=new Term(666,5);
f.addLast(b);
while(!f.isEmpty()){
Term tmp=f.getFirst();
tmp.print();
f.removeFirst();
}
System.out.print();
}
}
package p1;import java.util.LinkedList;class aaa{ double coeff; int exp; public aaa(double coeff, int exp){ this.coeff=coeff; this.exp=exp; } void print(){ if (coeff>0) System.out.print("+"+coeff); else System.out.print(coeff); System.out.print("x^"+exp); } }
public class ex2 {
public static void main(String[] args) {
aaa A = new aaa (789,101); System.out.print("f(x)="); A.print(); System.out.println(); LinkedList f = new LinkedList(); f.addLast(A); aaa B = new aaa(-5,2); f.addLast(B); aaa C = new aaa(19,0); f.addLast(C); while (!f.isEmpty()){ aaa tmp=f.getFirst(); tmp.print(); f.removeFirst(); } System.out.println(); }
}
張貼留言