解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int[][] st=new int [n][n];
int sum=0;
for(int i=0;i<st.length;i++){
for(int x=0;x<st[i].length;x++){
st[i][x]=sc.nextInt();
if(i==x|i+x==n-1)
sum+=st[i][x];}
}
System.out.print(sum);
}
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:652 |
【亲和数】 (C语言代码)浏览:859 |
2006年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:472 |
震宇大神的杀毒软件 (C语言代码)浏览:1080 |
输出九九乘法表 (C语言代码)浏览:1048 |
C语言程序设计教程(第三版)课后习题6.7 (C语言代码)浏览:699 |
Manchester-汽水瓶问题浏览:4161 |
Manchester-台球碰撞-(附带图解)浏览:3713 |
字符串的修改 (C++代码)浏览:2890 |
Manchester- A+B for Input-Output Practice (VI)浏览:1984 |