標題:
APCS - Java 高效讀取 (二)
[打印本頁]
作者:
tonyh
時間:
2022-12-17 20:45
標題:
APCS - Java 高效讀取 (二)
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Ch100 {
int n[], len;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String raw[];
Ch100() throws Exception
{
System.out.print("請輸入多個整數 (以空白分隔): ");
raw=br.readLine().split(" ");
len=raw.length;
n=new int[len];
for(int i=0; i<len; i++)
n[i]=Integer.parseInt(raw[i]);
Arrays.sort(n);
System.out.print("排序後: ");
for(int i=0; i<len; i++)
System.out.print(n[i]+" ");
System.out.println();
}
public static void main(String[] args) throws Exception {
new Ch100();
}
}
複製代碼
作者:
丁肇志
時間:
2022-12-17 21:01
import java.io.*;
import java.util.*;
public class Ch100 {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int data[];
String str[];
Ch100() throws Exception {
System.out.print("請輸入多個整數 (以空白分隔): ");
str = br.readLine().split(" ");
data = new int[str.length];
for (int i = 0; i < str.length; i++)
data[i] = Integer.parseInt(str[i]);
Arrays.sort(data);
for (int i : data)
System.out.print(i + " ");
}
public static void main(String[] args) throws Exception {
new Ch100();
}
}
複製代碼
作者:
許志捷
時間:
2022-12-17 23:43
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String a[];
int len,n[];
Main() throws Exception
{
System.out.print("輸入多個整數(以空白隔開): ");
a=br.readLine().split(" ");
len=a.length;
n=new int[len];
for(int i=0;i<len;i++)
{
n[i]=Integer.parseInt(a[i]);
}
Arrays.sort(n);
System.out.print("排序後: ");
for(int i=0;i<len;i++)
{
System.out.print(n[i]+" ");
}
System.out.println();
}
public static void main(String[] args) throws Exception{
new Main();
}
}
複製代碼
作者:
余柏緯
時間:
2022-12-24 19:08
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
class C520 {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String raw[];
int data[],len;
C520() throws IOException
{
System.out.print("請輸入多個數字(空白分隔): ");
raw=br.readLine().split(" ");
len=raw.length;
data=new int[len];
for(int i=0;i<len;i++)
data[i]=Integer.parseInt(raw[i]);
Arrays.sort(data);
for(int i:data)
System.out.print(i+" ");
System.out.println();
}
public static void main(String[] args) throws IOException {
new C520();
}
}
複製代碼
作者:
黃子倢
時間:
2022-12-24 19:27
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
public class P5 {
int n[], len;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String raw[];
P5() throws Exception
{
System.out.print("請輸入多個整數 (以空白分隔):");
raw=br.readLine().split(" ");
len=raw.length;
n=new int[len];
for(int i=0; i<len; i++)
n[i]=Integer.parseInt(raw[i]);
Arrays.sort(n);
System.out.print("排序後:");
for(int i=0; i<len; i++)
System.out.print(n[i]+" ");
System.out.println();
}
public static void main(String[] args) throws Exception {
new P5();
}
}
複製代碼
作者:
王秉鈞
時間:
2022-12-24 19:31
import java.io.*;
import java.util.Arrays;
public class Ch48 {
int n[],len;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String raw[];
Ch48() throws Exception
{
System.out.print("enter some 整數");
raw=br.readLine().split(" ");
len=raw.length;
for(int i=0;i<len;i++)
n[i]=Integer.parseInt(raw[i]);
Arrays.sort(n);
for(int i=0;i<len;i++)
System.out.print(n[i]+" ");
System.out.println();
}
public static void main(String[] args) {
new Ch48();
}
}
複製代碼
作者:
張博竣
時間:
2022-12-24 19:32
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Ch100 {
int n[], len;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String raw[];
Ch100() throws Exception
{
System.out.print("請輸入多個整數 (以空白分隔): ");
raw=br.readLine().split(" ");
len=raw.length;
n=new int[len];
for(int i=0; i<len; i++)
n[i]=Integer.parseInt(raw[i]);
Arrays.sort(n);
System.out.print("排序後: ");
for(int i=0; i<len; i++)
System.out.print(n[i]+" ");
System.out.println();
}
public static void main(String[] args) throws Exception {
new Ch100();
}
}
複製代碼
作者:
許洧熏
時間:
2022-12-24 19:38
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Ch01 {
int n[], len;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String raw[];
Ch01() throws Exception
{
System.out.print("請輸入多個整數 (以空白分隔): ");
raw=br.readLine().split(" ");
len=raw.length;
n=new int[len];
for(int i=0; i<len; i++)
n[i]=Integer.parseInt(raw[i]);
Arrays.sort(n);
System.out.print("排序後: ");
for(int i=0; i<len; i++)
System.out.print(n[i]+" ");
System.out.println();
}
public static void main(String[] args) throws Exception {
new Ch01();
}
}
複製代碼
作者:
曾元瑜
時間:
2022-12-24 19:40
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Arrays;
public class B2 {
int n[],len;
String raw[];
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
B2() throws Exception{
System.out.print("請輸入多個整數 (以空白分隔): ");
raw=br.readLine().split(" ");
len=raw.length;
n=new int[len];
for(int i=0;i<len;i++)
n[i]=Integer.parseInt(raw[i]);
Arrays.sort(n);
System.out.print("排序後: ");
for(int i=0; i<len; i++)
System.out.print(n[i]+" ");
System.out.println();
}
public static void main(String[] args) throws Exception{
new B2();
}
}
複製代碼
作者:
王法棣
時間:
2022-12-24 19:41
package ch02;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class ch02 {
int n[],len;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String raw[];
ch02() throws IOException
{
System.out.print("請輸入多個整數 (以空白分隔): ");
raw=br.readLine().split(" ");
len=raw.length;
n=new int[len];
for(int i=0;i<len;i++)
{
n[i]=Integer.parseInt(raw[i]);
}
Arrays.sort(n);
for(int i:n)
System.out.print(i+" ");
}
public static void main(String[] args) throws IOException {
new ch02();
}
}
複製代碼
作者:
吳昀瑢
時間:
2022-12-24 19:57
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
public class A01 {
int n[], len;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String raw[];
A01() throws Exception
{
System.out.print("請輸入多個整數 (以空白分隔): ");
raw=br.readLine().split(" ");
len=raw.length;
n=new int[len];
for(int i=0;i<len;i++)
{
n[i]=Integer.parseInt(raw[i]);
}
Arrays.sort(n);
System.out.print("排序後: ");
for(int i=0;i<len;i++)
{
System.out.print(n[i]+" ");
}
System.out.println();
}
public static void main(String[] args) throws Exception{
new A01();
}
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2