String X=" What test is that? this is a....."
1.去掉空格
2. 取子字串4~21
3. this->這, is->是, a->一個, test->嘗試
4. 改大寫
5. 字串反轉
6. 將字串2,4,6,8,10,.....的字元組成一新字串
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開...
28 則留言:
import java.security.SecureRandom;
public class jimmy12 {
public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int[]a=new int[100]; int[]count=new int[10]; int y; for(int i=0;i<a.length;i++){ y=a[i]=rnd.nextInt(10); System.out.print(y+",\t"); if(i%10==9)System.out.println(); count[y]++; } System.out.println(); for(int j=0;j<count.length;j++){ System.out.println(j+"出現次數"+count[j]); } }}
import javax.xml.crypto.dsig.spec.XSLTTransformParameterSpec;public class abcd {public static void main(String[] args) { String x=" What test is that? this is a....."; System.out.println(x); x=x.replace(" ",""); System.out.println(x); x=x.substring(4,22); System.out.println(x); x=x.replace("this","這"); x=x.replace("is","是"); x=x.replace("a","一個"); x=x.replace("test","嘗試"); System.out.println(x); x=x.toUpperCase(); System.out.println(x); String a=""; for(int i=x.length()-1;i>0;i--) a+=x.charAt(i); x=a; System.out.print(a); String y=""; for(int j=2;j<a.length()-1;j+=2) y+=a.charAt(j); System.out.println(); System.out.print(y);}}
public class X1211 {
public static void main(String[] args) { String X="What test is that?this is a...."; X=X.replace(" ",""); System.out.println(X); X=X.substring(4,22); System.out.println(X); X=X.replace("this","這"); X=X.replace("is","是"); X=X.replace("a","一個"); X=X.replace("test","嘗試"); System.out.println(X); X=X.toUpperCase(); System.out.println(X); String X1=new String(new StringBuffer(X).reverse()); String tmp=""; for(int i=X.length()-1;i>=0;i--) tmp+=X.charAt(i); X=tmp; System.out.println(X); String X2=""; for(int i=2;i<X.length();i+=2){ X2+=X.charAt(i); } System.out.println(X2); } }
public class ccc29 {
public static void main(String[] args) { String X=" What test is that? this is a....."; X=X.replace(" ", ""); System.out.println(X); System.out.println(X=X.substring(4,22)); X=X.replace("this","這"); X=X.replace("is","是"); X=X.replace("a","一個"); X=X.replace("test","嘗試"); System.out.println(X); X=X.toUpperCase(); System.out.println(X); String tmp=""; for(int i=X.length()-1;i>=0;i--) tmp+=X.charAt(i); X=tmp; System.out.println(X); String X2=""; for(int i=2;i<X.length();i+=2){ X2+=X.charAt(i); } System.out.println(X2); } }
public class ex11 {
public static void main(String[] args) { String X="what test is that? this is a...."; X=X.replace(" ",""); System.out.println(X); X=X.replace("this","這"); X=X.replace("tis","是"); X=X.replace("a","一個"); X=X.replace("test","嘗試"); System.out.println(X); X=X.toUpperCase(); System.out.println(X); String X1=new String(new StringBuffer(X).reverse()); String tmp=""; for(int i=X.length()-1;i>=0;i--) tmp+=X.charAt(i); X=tmp; System.out.println(X); String X2=""; for(int i=2;i<X.length();i+=2){ X2+=X.charAt(i); } System.out.println(X2);
}
}
public class ccc29 {
public static void main(String[] args) { String X=" What test is that? this is a....."; X=X.replace(" ", ""); System.out.println(X); System.out.println(X=X.substring(4,22)); X=X.replace("this","這"); X=X.replace("is","是"); X=X.replace("a","一個"); X=X.replace("test","嘗試"); System.out.println(X); X=X.toUpperCase(); System.out.println(X); String tmp=""; for(int i=X.length()-1;i>=0;i--) tmp+=X.charAt(i); X=tmp; System.out.println(X); String X2=""; for(int i=2;i<X.length();i+=2){ X2+=X.charAt(i); } System.out.println(X2); } }
public class ex2 {
public static void main(String[] args) {
String X=" What test is that? this is a.....";
X=X.replace(" ", "");
System.out.println(X);
X=X.substring(4,22);
System.out.println(X);
X=X.replace("this", "這");
X=X.replace("is", "是");
X=X.replace("a", "一個");
X=X.replace("test", "嘗試");
System.out.println(X);
X=X.toUpperCase();
System.out.println(X);
String tmp="";
for(int i=X.length()-1;i>=0;i--)
tmp+=X.charAt(i);
X=tmp;
System.out.println(X);
String X2="";
for(int i=2;i<X.length();i+=2){
X2+=X.charAt(i);
}
System.out.println(X2);
}}
package zz;
public class z2 {
public static void main(String[] args) { String X=" What test is that? this is a....."; X=X.replace(" ",""); X=X.substring(4,22); X=X.replace("this","這"); X=X.replace("is","是"); X=X.replace("a","一個"); X=X.replace("test","嘗試"); X=X.toUpperCase(); System.out.println(X); String x1 = new String(new StringBuffer(X).reverse()); String tmp=""; for(int i =X.length()-1;i>=0;i--) tmp+=X.charAt(i); X=tmp; System.out.println(X); String X2=""; for(int i=2;i<X.length();i+=2){ X2+=X.charAt(i); } System.out.println(X2); } }
package rpg; public class FHM { public static void main(String[] args) { String x=" What test is that? this is a....."; x=x.replace(" ",""); x=x.substring(4,22); x=x.replace("this","這"); x=x.replace("is","是"); x=x.replace("a","一個"); x=x.replace("test","嘗試"); x=x.toUpperCase();String a; char y[]=x.toCharArray(); String x1=new String(new StringBuffer(x).reverse()); String d=""; for(int i=x.length()-1;i>=0;i--) d+=x.charAt(i); x=d; System.out.println(x); String x2=""; for(int i=2;i
package rpg; public class FHM { public static void main(String[] args) { String x=" What test is that? this is a....."; x=x.replace(" ",""); x=x.substring(4,22); x=x.replace("this","這"); x=x.replace("is","是"); x=x.replace("a","一個"); x=x.replace("test","嘗試"); x=x.toUpperCase();String a; char y[]=x.toCharArray(); String x1=new String(new StringBuffer(x).reverse()); String d=""; for(int i=x.length()-1;i>=0;i--) d+=x.charAt(i); x=d; System.out.println(x); String x2=""; for(int i=2;i
public class ex3 {
public static void main(String[] args) { String X="What test is that?this is a...."; X=X.replace("",""); System.out.println(X); X=X.substring(4, 22); System.out.println(X); X=X.replace("this","這"); X=X.replace("is","是"); X=X.replace("a","一個"); X=X.replace("test","嘗試"); System.out.println(X); X=X.toUpperCase(); System.out.println(X); String X1=new String(new StringBuffer(X).reverse());//StringBuffer// System.out.println(X1);// String tmp=""; //for loop法 for(int i=X.length()-1;i>=0;i--) tmp+=X.charAt(i); X=tmp; System.out.println(X); String X2=""; for(int i=2;i<X.length();i+=2){ X2+=X.charAt(i); } System.out.println(X2); }
}
public class ex3 {
public static void main(String[] args) { String X="What test is that?this is a...."; X=X.replace("",""); System.out.println(X); X=X.substring(4, 22); System.out.println(X); X=X.replace("this","這"); X=X.replace("is","是"); X=X.replace("a","一個"); X=X.replace("test","嘗試"); System.out.println(X); X=X.toUpperCase(); System.out.println(X); String X1=new String(new StringBuffer(X).reverse());//StringBuffer// System.out.println(X1);// String tmp=""; //for loop法 for(int i=X.length()-1;i>=0;i--) tmp+=X.charAt(i); X=tmp; System.out.println(X); String X2=""; for(int i=2;i<X.length();i+=2){ X2+=X.charAt(i); } System.out.println(X2); }
}
public class ex3 {
public static void main(String[] args) { String X="What test is that?this is a...."; X=X.replace("",""); System.out.println(X); X=X.substring(4, 22); System.out.println(X); X=X.replace("this","這"); X=X.replace("is","是"); X=X.replace("a","一個"); X=X.replace("test","嘗試"); System.out.println(X); X=X.toUpperCase(); System.out.println(X); String X1=new String(new StringBuffer(X).reverse());//StringBuffer// System.out.println(X1);// String tmp=""; //for loop法 for(int i=X.length()-1;i>=0;i--) tmp+=X.charAt(i); X=tmp; System.out.println(X); String X2=""; for(int i=2;i<X.length();i+=2){ X2+=X.charAt(i); } System.out.println(X2); }
}
public class ex3 {
public static void main(String[] args) { String X="What test is that?this is a...."; X=X.replace("",""); System.out.println(X); X=X.substring(4, 22); System.out.println(X); X=X.replace("this","這"); X=X.replace("is","是"); X=X.replace("a","一個"); X=X.replace("test","嘗試"); System.out.println(X); X=X.toUpperCase(); System.out.println(X); String X1=new String(new StringBuffer(X).reverse());//StringBuffer// System.out.println(X1);// String tmp=""; //for loop法 for(int i=X.length()-1;i>=0;i--) tmp+=X.charAt(i); X=tmp; System.out.println(X); String X2=""; for(int i=2;i<X.length();i+=2){ X2+=X.charAt(i); } System.out.println(X2); }
}
package hello;
import java.security.SecureRandom;
public class ex2 {
public static void main(String[] args) { SecureRandom rnd=new SecureRandom(); int[]a=new int[100]; int[]count=new int[10]; int y; for(int i=0;i<a.length;i++){ y=a[i]=rnd.nextInt(10); System.out.print(y+",\t"); if(i%10==9)System.out.println(); count[y]++; } System.out.println(); for(int j=0;j<count.length;j++){ System.out.println(j+"出現次數:"+count[j]); } }
}
public class a02 {
public static void main(String[] args) { String X="What test is that? this is a ...."; X=X.replace("",""); System.out.println(X); X=X.substring(4,22); System.out.println(X); X=X.replace("this","這"); X=X.replace("is","是"); X=X.replace("a","一個"); X=X.replace("test","嘗試"); System.out.println(X); X=X.toUpperCase(); System.out.println(X); String X1=new String(new StringBuffer(X).reverse());//StringBuffer //System.out,println(X1); // String tmp="";//for loop法 for(int i=X.length()-1;i>=0;i--) tmp+=X.charAt(i); X=tmp; System.out.println(X); String X2=""; for(int i=2;i<X.length();i+=2){ } System.out.println(X2); }
}
public class JIM12 {
public static void main(String[] args) { String X="What testis that?this is a..."; X=X replace("",""); System.out.println(X); X=X substring(4,22); System.out.println(x); X=X replace("this","這"); X=X replace("is","是"); X=X replace("a","一個"); X=X replace("test","嘗試") System.out.println(X); X=X toUpperCase(); System.out.println(X); String X1=new String(new string buffer(X).reverse();//stringBuffer// System.out.println(X1);// String tmp""//for loop法 }
}
public class ex4 { static int[]SmallPrime={2,3,5,7};//Math.sqrt(120)=10.xx static boolean isPrime(int N){ for(int i=0;i<SmallPrime.length;i++) if(N==SmallPrime[i]) return true; else if(N%SmallPrime[i]==0) return false; return true; } public static void main(String[] args) { int count=0; for(int i=3; i<=120; i++) { if(isPrime(i)&&isPrime(i+2)) System.out.println((++count)+":("+i+","+(i+2)+")");
}
}
}
public class ex4 { static int[]SmallPrime={2,3,5,7};//Math.sqrt(120)=10.xx static boolean isPrime(int N){ for(int i=0;i<SmallPrime.length;i++) if(N==SmallPrime[i]) return true; else if(N%SmallPrime[i]==0) return false; return true; } public static void main(String[] args) { int count=0; for(int i=3; i<=120; i++) { if(isPrime(i)&&isPrime(i+2)) System.out.println((++count)+":("+i+","+(i+2)+")");
}
}
}
public class ex4 { static int[]SmallPrime={2,3,5,7};//Math.sqrt(120)=10.xx static boolean isPrime(int N){ for(int i=0;i<SmallPrime.length;i++) if(N==SmallPrime[i]) return true; else if(N%SmallPrime[i]==0) return false; return true; } public static void main(String[] args) { int count=0; for(int i=3; i<=120; i++) { if(isPrime(i)&&isPrime(i+2)) System.out.println((++count)+":("+i+","+(i+2)+")");
}
}
}
public class ex4 { static int[]SmallPrime={2,3,5,7};//Math.sqrt(120)=10.xx static boolean isPrime(int N){ for(int i=0;i<SmallPrime.length;i++) if(N==SmallPrime[i]) return true; else if(N%SmallPrime[i]==0) return false; return true; } public static void main(String[] args) { int count=0; for(int i=3; i<=120; i++) { if(isPrime(i)&&isPrime(i+2)) System.out.println((++count)+":("+i+","+(i+2)+")");
}
}
}
public class ex2 { public static void main(String[] args) { String x="What test is that? this is a....."; System.out.println(x=x.replace(" ","")); System.out.println(x.substring(4,22)); x=x.substring(4,22); x=x.replace("this","這"); x=x.replace("a","一個"); x=x.replace("test","嘗試"); x=x.replace("is","是"); System.out.println(x); System.out.println(x.toUpperCase()); x=x.toUpperCase(); String X1=new String(new StringBuffer(x).reverse()); String tmp=""; for(int i=x.length()-1;i>=0;i--) tmp+=x.charAt(i); x=tmp; System.out.println(x); String X2=""; for(int i=2;i<x.length();i+=2){ X2+=x.charAt(i); } System.out.println(X2); }}
public class cccc {
public static void main(String[] args) { String x=" What test is that? this is a....."; x=x.replace(" ", ""); System.out.println(x); x=x.substring(4, 22); System.out.println(x); x=x.replace("this","這" ); x=x.replace("is","是" ); x=x.replace("a","一個" ); x=x.replace("test","嘗試" ); System.out.println(x); x=x.toUpperCase(); System.out.println(x); String z=""; for (int i=x.length()-1;i>=0;i--) z+=x.charAt(i); x=z; System.out.print(x); String zx=""; for(int c=2;c<x.length();c+=2) zx+=x.charAt(c); x=zx; }}
public class cccc {
public static void main(String[] args) { String x=" What test is that? this is a....."; x=x.replace(" ", ""); System.out.println(x); x=x.substring(4, 22); System.out.println(x); x=x.replace("this","這" ); x=x.replace("is","是" ); x=x.replace("a","一個" ); x=x.replace("test","嘗試" ); System.out.println(x); x=x.toUpperCase(); System.out.println(x); String z=""; for (int i=x.length()-1;i>=0;i--) z+=x.charAt(i); x=z; System.out.print(x); String zx=""; for(int c=2;c<x.length();c+=2) zx+=x.charAt(c); x=zx; }}
public static void main(String[] args) { String X=" What test is that? this is a....."; X=X.replace(" ",""); X=X.substring(4,22); X=X.replace("this","這"); X=X.replace("is","是"); X=X.replace("a","一個"); X=X.replace("test","嘗試"); X=X.toUpperCase(); System.out.println(X); String x1 = new String(new StringBuffer(X).reverse()); String tmp=""; for(int i =X.length()-1;i>=0;i--) tmp+=X.charAt(i); X=tmp; System.out.println(X); String X2=""; for(int i=2;i<X.length();i+=2){ X2+=X.charAt(i); } System.out.println(X2); } }
public class ex3 {
public static void main(String[] args) { String X="What test is that?this is a...."; X=X.replace("",""); System.out.println(X); X=X.substring(4, 22); System.out.println(X); X=X.replace("this","這"); X=X.replace("is","是"); X=X.replace("a","一個"); X=X.replace("test","嘗試"); System.out.println(X); X=X.toUpperCase(); System.out.println(X); String X1=new String(new StringBuffer(X).reverse());//StringBuffer// System.out.println(X1);// String tmp=""; //for loop法 for(int i=X.length()-1;i>=0;i--) tmp+=X.charAt(i); X=tmp; System.out.println(X); String X2=""; for(int i=2;i<X.length();i+=2){ X2+=X.charAt(i); } System.out.println(X2); }
}
public class ex2 { public static void main(String[] args) { String x="What test is that? this is a....."; System.out.println(x=x.replace(" ","")); System.out.println(x.substring(4,22)); x=x.substring(4,22); x=x.replace("this","這"); x=x.replace("a","一個"); x=x.replace("test","嘗試"); x=x.replace("is","是"); System.out.println(x); System.out.println(x.toUpperCase()); x=x.toUpperCase(); String X1=new String(new StringBuffer(x).reverse()); String tmp=""; for(int i=x.length()-1;i>=0;i--) tmp+=x.charAt(i); x=tmp; System.out.println(x); String X2=""; for(int i=2;i<x.length();i+=2){ X2+=x.charAt(i); } System.out.println(X2); }}
public class ex4 { static int[]SmallPrime={2,3,5,7};//Math.sqrt(120)=10.xx static boolean isPrime(int N){ for(int i=0;i<SmallPrime.length;i++) if(N==SmallPrime[i]) return true; else if(N%SmallPrime[i]==0) return false; return true; } public static void main(String[] args) { int count=0; for(int i=3; i<=120; i++) { if(isPrime(i)&&isPrime(i+2)) System.out.println((++count)+":("+i+","+(i+2)+")");
}
}
}
張貼留言