20个人围成圈数数,从1开始数,数到3推出,接着从1开始数,数到3推出,问最后一个推出的是哪个?急。。
解决方案 »
- 输入框focus
- 关于jsp调用activeX控件内方法的问题
- struts中select标签我想label和select应用不同的css怎么实现?
- js css能不能不用提前加在页面,只要有JSP标签就能自动加载正确的JS、CSS文件
- 在线求救
- 100分跪求 java中如何调用存储过程,我的存储过程带有返回值
- 乱码问题 再线等
- 快看这里-----------如何不提示下载文件而执行.exe文件???问题解决即给分!无厘头大哥你在哪????
- CP/IP协议的数据采集软件实现原理
- 请教:如何在JSP中实现媒体播放
- Ext运行页面出错:'events'为空或不是对象,不知道什么地方出错了!
- 一个效果,难以入眠,你的技术可以治疗我的失眠!
这有个这种问题的代码 public static int jos1( int people, int passes )
{
Collection<Integer> theList = new LinkedList<Integer>( ); // Construct the list
for( int i = 1; i <= people; i++ )
theList.add( i ); // Play the game;
Iterator<Integer> itr = theList.iterator( );
while( people-- != 1 )
{
for( int i = 0; i <= passes; i++ )
{
if( !itr.hasNext( ) )
itr = theList.iterator( );
itr.next( );
}
itr.remove( );
}
itr = theList.iterator( ); return itr.next( );
}在你这个问题里,people=20,pass=3