惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy & Cybersecurity Law Blog
V
V2EX
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
P
Privacy International News Feed
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
美团技术团队
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
K
Kaspersky official blog
S
Secure Thoughts
T
Tenable Blog
Security Latest
Security Latest
The Cloudflare Blog
S
Security @ Cisco Blogs
H
Heimdal Security Blog
aimingoo的专栏
aimingoo的专栏
TaoSecurity Blog
TaoSecurity Blog
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
Schneier on Security
Schneier on Security
Webroot Blog
Webroot Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
IT之家
IT之家
Latest news
Latest news
The Hacker News
The Hacker News
C
Check Point Blog
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
N
News | PayPal Newsroom
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
S
Security Affairs
S
Securelist
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
A
About on SuperTechFans

博客园 - 无痕的泪

任务栏不显示任务、不能有文件拖动、粘贴操作 登陆qq.电脑重启 WEB测试之兼容性测试 如何编写测试计划 boot disk failure,insert system disk and press enter quick sort 快速排序法 网游名字-调查 赖子山庄工作记录 软件测试面试题目————征求更好答案 比google 百度 更强(http://www.new1000.cn ) google sitemap 介绍(转载) server 2003 directx被禁用 Sql server 2005 的安装 loadrunner的安装 LoadRunner8.1 安装汉化 出错 软件测试准备(摘要) 网站测试方法 软件测试(分类,方法,工具) 软件测试分类
使用数组的方法,解决Josephus问题 - 无痕的泪 - 博客园
无痕的泪 · 2008-10-31 · via 博客园 - 无痕的泪

void main()             //使用数组的方法,解决Josephus问题-----还没搞懂
{
 const int num=20;
 int interval;
 int a[num];
 for(int x=0;x<num;x++)
  a[x]=x+1;
 cout<<"please input the interval:";
 cin>>interval;
 for(int j=0;j<num;j++)
  cout<<a[j]<<",";
 cout<<endl;

 int k=1;
 int i=-1;

 while(1)
 {
  for(int j=0;j<interval;)
  {
   i=(i+1)%num;
   if(a[i]!=0)
    j++;
  }
  if(k==num)break;
  cout<<a[i]<<",";
  a[i]=0;

  k++;
 }
 cout<<"\n no."<<a[i]<<" boy's won.\n";
}