码迷,mamicode.com
首页 > 其他好文 > 详细

URAL 1313 Some Words about Sport

时间:2014-08-26 09:42:05      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   java   for   ar   div   log   amp   

斜着数

 1 import java.util.Scanner;
 2 
 3 public class P1313
 4 {
 5     public static void main(String args[])
 6     {
 7         try (Scanner cin = new Scanner(System.in))
 8         {
 9             while (cin.hasNext())
10             {
11                 int n = cin.nextInt();
12                 int a[][] = new int[n][n];
13                 for (int i = 0; i < n; i++)
14                     for (int j = 0; j < n; j++)
15                         a[i][j] = cin.nextInt();
16                 for (int k = 0; k < 2 * n - 1; k++)
17                     for (int j = 0; j < n; j++)
18                     {
19                         int i = k - j;
20                         if (i >= 0 && i < n)
21                             System.out.print(a[i][j] + " ");
22                     }
23                 System.out.println();
24             }
25         }
26     }
27 }

 

URAL 1313 Some Words about Sport

标签:style   blog   color   java   for   ar   div   log   amp   

原文地址:http://www.cnblogs.com/gwhahaha/p/3936478.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!