fork download
  1. class Flawiusz
  2. {
  3. public static void main(String[] args)
  4. {
  5. boolean[] deleted = new boolean[1000];
  6. int howManyDeleted = 0;
  7. int index = 0;
  8. int counter = 0;
  9. while (howManyDeleted < 990)
  10. {
  11. while(counter < 7)
  12. {
  13. if(!deleted[index])
  14. {
  15. counter++;
  16. }
  17. if(counter == 7)
  18. {
  19. deleted[index] = true;
  20. counter = 0;
  21. howManyDeleted++;
  22. break;
  23. }
  24. index = (index + 1)%1000;
  25. }
  26. }
  27. for(int i=0;i<1000;i++)
  28. {
  29. if(!deleted[i])
  30. {
  31. System.out.print((i+1)+" ");
  32. }
  33. }
  34. }
  35. }
Success #stdin #stdout 0.1s 320512KB
stdin
Standard input is empty
stdout
103 160 166 297 404 547 724 737 757 830