循环赛程表【only code】
来源:互联网 发布:smtp 修改端口号 编辑:程序博客网 时间:2024/06/10 06:14
#include <cstdio> #include <cstring>#include <iostream>using namespace std;#define maxn 110int ans[maxn][maxn];void cal(int l,int r,int ll,int rr,int d){ int upmid=(r+l)>>1,leftmid=(rr+ll)>>1; for(int i=l;i<=upmid;i++) for(int j=leftmid+1;j<=rr;j++) ans[j][i]=ans[j-d][i+d]; for(int i=upmid+1;i<=r;i++) for(int j=leftmid+1;j<=rr;j++) ans[j][i]=ans[j-d][i-d];}int main(){ int n; while(cin>>n) { for(int i=1;i<=n;i++) { ans[1][i]=i; } for(int i=2;i<=n;i*=2) { for(int j=1;j<=n;j+=i) { cal(j,j+i-1,1,i,i>>1); } } for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) cout<<ans[i][j]<<" "; cout<<endl; } } return 0;}
0 0
- 循环赛程表【only code】
- TabViewController code only version
- 2006德国世界杯完全赛程表
- Comment Only What the Code Cannot Say
- Only the Code Tells the Truth
- Comment Only What the Code Cannot Say
- PHP 单文件上传 only code
- Only the Code Tells the Truth
- 2006年F1大奖赛赛程表
- 飘逸的python - 赛程表算法
- 飘逸的python - 赛程表算法
- 业余之作:codergenerator only for ebiz on google code
- How to Create WPF Docking Windows Using Code Only
- Unsafe code may only appear if compiling with /unsafe
- Unsafe code may only appear if compiling with /unsafe
- Feature CTP Walkthrough: Code Only for the Entity Framework
- Unsafe code may only appear if compiling with /unsafe
- Unsafe code may only appear if compiling with /unsafe
- dataguard部署
- Android 文件多线程断点续传下载
- c++ 内存分析
- activex 部署到web上问题
- 图形验证码实例
- 循环赛程表【only code】
- ML
- C语言 数据结构查找 顺序查找及折半查找
- Socket网络编程聊天,加多线程
- Servlet & JSP 基础8(过滤器和包装器)
- android消息机制理解(1)
- ios代码编写UIButton,设置图片,图片不显示
- APP开发及发布流程
- gets()、puts()和fgets()、fputs() 的区别。