本帖最后由 wtjohn 于 2014-11-15 19:56 编辑
- import java.util.ArrayList;
- public class Test03 {
- public static void main(String[] args) {
- count();
- }
- public static void count()
- {
- int max=100;
- int count=1;
- int index=0;
- ArrayList al=new ArrayList();
- for(int i=1;i<=max;i++)
- {
- al.add(i);
- }
- while(al.size()>14)
- {
- if(index==al.size()-1)
- {
- index=0;
- }
- if(count==14)
- {
- al.remove(index);
- max--;
- count=0;
- index--;
- }
- else
- {
- count++;
- index++;
- }
- }
- for(int i=0;i<al.size();i++)
- {
- System.out.println(al.get(i));
- }
-
- }
- }
复制代码
没加注释,应该能看懂吧 |
|