fork(1) download
  1. public class Main {
  2. public static void main(String[] args) {
  3. number372();
  4. }
  5.  
  6. public static void number372(){
  7. System.out.println(Print.print(Calc.calc(3, 90), ":", ",", 10));
  8. }
  9.  
  10. public static class Calc {
  11. public static int[] calc(int start, int max) {
  12. int[] array = new int[max];
  13. for (int count = 0, num = start; count < max; num += 3) {
  14. if (num % 7 != 2) {
  15. array[count++] = num;
  16. }
  17. }
  18. return array;
  19. }
  20. }
  21.  
  22. public static class Print {
  23. public static String print(int[] array, String lineSeparator, String elemSeparator, int lineMax) {
  24. int lineCount = 1;
  25.  
  26. sb.append(lineCount++ + lineSeparator);
  27. for (int i = 0; i < array.length; i++) {
  28. sb.append(array[i]);
  29.  
  30. if (i + 1 < array.length) {
  31. if ((i + 1) % lineMax == 0) {
  32. sb.append(System.lineSeparator());
  33. sb.append(lineCount++ + lineSeparator);
  34. } else {
  35. sb.append(elemSeparator);
  36. }
  37. }
  38. }
  39. return sb.toString();
  40. }
  41. }
  42. }
Success #stdin #stdout 0.07s 380160KB
stdin
Standard input is empty
stdout
1:3,6,12,15,18,21,24,27,33,36
2:39,42,45,48,54,57,60,63,66,69
3:75,78,81,84,87,90,96,99,102,105
4:108,111,117,120,123,126,129,132,138,141
5:144,147,150,153,159,162,165,168,171,174
6:180,183,186,189,192,195,201,204,207,210
7:213,216,222,225,228,231,234,237,243,246
8:249,252,255,258,264,267,270,273,276,279
9:285,288,291,294,297,300,306,309,312,315