#11675: 測試是AC ,並且有使用while,但還是一直WA


shualan780 (Alan Hsu)

學校 : 明新科技大學
編號 : 48435
來源 : [60.245.65.132]
最後登入時間 :
2017-12-27 19:59:36
a015. 矩陣的翻轉 | From: [114.136.233.218] | 發表日期 : 2017-01-16 01:53

package 基礎題庫;

import java.util.Scanner;

public class a015 {

public static void main(String[] args) {
// TODO Auto-generated method stub
int[][] R= null;
int[] R_temp;
Scanner sc = new Scanner(System.in);
String input;
String[] Splite1 ;
int count1=0;
while(sc.hasNext())
{
input = sc.nextLine();
Splite1 = input.split(" ");
R_temp = new int [Splite1.length];
if(count1 ==0) 
{
for(int i =0 ; i < Splite1.length;i++)
{
R_temp[i] = Integer.valueOf(Splite1[i]);
if(R_temp[i]>=100)
{
main(args);
}
}
R = new int[R_temp[0]][R_temp[1]];

}
if(count1!=0&&count1 <= R.length)
{
for(int i =0 ; i< Splite1.length;i++)
{
R[count1-1][i] = Integer.valueOf(Splite1[i]);
}
}
if(count1 ==R.length)
{

for(int j = 0 ;j <R[0].length;j++)
{
System.out.println();
for(int i =0; i < R.length ;i++)
{
if(i!=0&&i<R.length)
{
System.out.print(" ");
}
System.out.print(R[i][j]);
}
}
System.out.println();
main(args);
}

count1++;
}
}
}

 
ZeroJudge Forum