風雨同路共送呂布
2007-04-27 08:21:47 UTC
class Miracle
{
public static void main(String args[])
{
int Graph[][]={{0,1,1,1,0,0,0,0,0,0,0,0,1},{1,0,1,1,0,0,0,0,0,0,0,0,0},
{1,1,0,1,0,0,0,0,0,0,0,0,0},{1,1,1,0,1,1,0,0,0,0,0,0,1},
{0,0,0,1,0,1,1,0,0,0,0,0,0},{0,0,0,1,1,0,1,1,1,0,0,0,0},
{0,0,0,0,1,1,0,1,0,0,0,0,0},{0,0,0,0,0,1,1,0,1,0,0,0,0},
{0,0,0,0,0,1,0,1,0,1,0,0,0},{0,0,0,0,0,0,0,0,1,0,1,0,0},
{0,0,0,0,0,0,0,0,0,1,0,1,0},{0,0,0,0,0,0,0,0,0,0,1,0,0},
{1,0,0,1,0,0,0,0,0,0,0,0,0}
};
//執行這段程式碼 會跑出ArrayIndexoutOfBoundsexception
/*int i,j;
for(i=0;i<13;i++)
{
for(j=0;j<13;j++);
System.out.print(Graph[i][j]);
System.out.println();
}
*/
//若採用這段程式碼 卻是順利執行
//但這兩段程式明明是一模一樣的 怎麼會結果差很多
//這可以算是奇蹟嗎? 還是這兩段程式有不同之處?希望有人能解惑 謝謝
int i,j;
for(i=0;i<13;i++)
{
for(j=0;j<13;j++)
System.out.print(Graph[i][j]);
System.out.println();
}
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.139.145.85
{
public static void main(String args[])
{
int Graph[][]={{0,1,1,1,0,0,0,0,0,0,0,0,1},{1,0,1,1,0,0,0,0,0,0,0,0,0},
{1,1,0,1,0,0,0,0,0,0,0,0,0},{1,1,1,0,1,1,0,0,0,0,0,0,1},
{0,0,0,1,0,1,1,0,0,0,0,0,0},{0,0,0,1,1,0,1,1,1,0,0,0,0},
{0,0,0,0,1,1,0,1,0,0,0,0,0},{0,0,0,0,0,1,1,0,1,0,0,0,0},
{0,0,0,0,0,1,0,1,0,1,0,0,0},{0,0,0,0,0,0,0,0,1,0,1,0,0},
{0,0,0,0,0,0,0,0,0,1,0,1,0},{0,0,0,0,0,0,0,0,0,0,1,0,0},
{1,0,0,1,0,0,0,0,0,0,0,0,0}
};
//執行這段程式碼 會跑出ArrayIndexoutOfBoundsexception
/*int i,j;
for(i=0;i<13;i++)
{
for(j=0;j<13;j++);
System.out.print(Graph[i][j]);
System.out.println();
}
*/
//若採用這段程式碼 卻是順利執行
//但這兩段程式明明是一模一樣的 怎麼會結果差很多
//這可以算是奇蹟嗎? 還是這兩段程式有不同之處?希望有人能解惑 謝謝
int i,j;
for(i=0;i<13;i++)
{
for(j=0;j<13;j++)
System.out.print(Graph[i][j]);
System.out.println();
}
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.139.145.85