soj 3960: The Bovine Fire Drill
来源:互联网 发布:米尼步枪图片数据 编辑:程序博客网 时间:2024/06/05 07:20
题目描述: http://cs.scu.edu.cn/soj/problem.action?id=3960
这是一道简单的模拟题,但是不小心错了几次.
#include<iostream>
#include<string>
using namespace std;
bool visit[256];
int main()
{
int n, i, cow[256];
while(scanf("%d",&n)==1)
{
for(i=1;i<=n;++i)
{
cow[i]=i;
visit[i]=0;
}
int index = 1;
int ordcow;
int newcow=1;
while(!visit[newcow])
{
ordcow= newcow;
visit[ordcow]=true;
index = (index + ordcow-1)%n+1;
newcow = cow[index];
cow[index]=ordcow;
if(index == 1)
{
break;
}
}
printf("%d\n",ordcow);
}
//system("pause");
return 0;
}
- soj 3960: The Bovine Fire Drill
- UVALive 5066 Fire Drill
- Fire Drill [UvaLive 5064] BFS+0/1背包
- UVALive 5066 - Fire Drill (BFS+01背包)
- poj 2458 Rigging the Bovine Election
- POJ 2458 Rigging the Bovine Election
- SOJ.The hardest problem
- fire the hole
- SOJ 2035: The Tiling Problem
- SOJ 2505: The County Fair
- SOJ.Output the Yanghui triangel
- SOJ 2505 The Country Fair
- bzoj1675 [Usaco2005 Feb]Rigging the Bovine Election 竞选划区
- BZOJ1575 USACO 2009 Jan Gold 2.The Baric Bovine
- Let's pay attention & join the Drill Project
- soj
- hdu 3931 Cross the Fire
- hdu 3931 Cross the Fire
- 编写基于linux的lcd驱动
- 一位软件工程师的6年总结
- CEGUI自定义光标
- 系统参数配置的存储管理与应用的通用方法
- Windows Media Player11安装验证解决方案(WMP11在XP安装)
- soj 3960: The Bovine Fire Drill
- ant javac Unknown Source 问题
- 离开,是为了新的开始
- java解压缩zip文件,java创建zip文件,java压缩文件,java解压文件,用到ant.jar解决汉字乱码
- Android通过http协议POST传输方式
- 将常用的字符串资源化
- JAVA正则表达式 Pattern和Matcher
- [转]Ultra Fractal 5.04 破解版汉化包
- 黑马程序员_IO输入与输出