zoj 1088
来源:互联网 发布:python如何编写脚本 编辑:程序博客网 时间:2024/05/22 12:31
//模拟问题
code:
#include<iostream>
using namespace std;
int ans[200];
int circle(int n,int m)
{
bool c[200];
fill(c,c+n+1,false);
int i,j,cnt=0,u=0;
for(i=1;i<=n;i++)
{
if(c[i]==false)
{
cnt++;
if(cnt==m)
{
c[i]=true;
u++;
cnt=0;
}
}
if(u==n-1) break;
if(i==n)
{
for(j=1;j<=n;j++)
{
if(c[j]==false)
{
i=j-1;
break;
}
}
}
}
for(i=1;i<=n;i++)
{
if(c[i]==false) return i;
}
return 0;
}
void calculate()
{
int i,j;
for(i=3;i<150;i++)
{
for(j=2;;j++)
{
if(circle(i-1,j)==1)
{
ans[i]=j;
break;
}
}
}
}
int main()
{
calculate();
int n;
while(scanf("%d",&n)!=EOF && n!=0)
{
printf("%d/n",ans[n]);
}
return 0;
}
- zoj 1088
- zoj 1088
- zoj 1088
- ZOJ-1088
- zoj 1088
- zoj 1088 System Overload
- zoj-1088-System Overload
- zoj 1088 System Overload
- zoj 1088 System Overload
- zoj 1088 约瑟夫环
- ZOJ 1088 System Overload
- zoj--1088--System Overload
- ZOJ 1088 System Overload
- zoj 1088 System Overload
- ZOJ 1088 System Overload
- ZOJ 1088 System Overload
- ZOJ
- ZOJ
- 在VC中怎样实现软件的注册机制
- oracle 中调用DLL
- Linux常用命令之vmstat
- Iperf: 一个优秀的网络性能测量工具
- zoj 1074
- zoj 1088
- 通过Setters方式进行普通属性的IOC注入
- zoj 1089
- GridView中的CheckBox单击事件(oncheckedchanged)
- ASP.NET 2.0 中动态添加 GridView 模板列 以及取值的例子
- 常用颜色的RGB值及中英文名称
- 初试 iterator
- 停止setInterval方法
- Qt4.5实现透明窗体