标签:
1 public class Solution 2 { 3 public static void main(String[] args) 4 { 5 int count = 0; 6 7 for(int i = 1; i <= 100; i++) 8 { 9 System.out.print(getPentagonalNumber(i) + " "); 10 count++; 11 12 if(count == 10) 13 { 14 System.out.println(); 15 count = 0; 16 } 17 } 18 } 19 20 public static int getPentagonalNumber(int n) 21 { return n * (3 * n - 2) / 2; } 22 }
标签:
原文地址:http://www.cnblogs.com/wood-python/p/5789255.html