Welcome![Sign In][Sign Up]
Location:
Search - horse

Search list

[Game ProgramHorse Race.zip

Description:
Platform: | Size: 355865 | Author: | Hits:

[Other用c编写的N*N的螺旋矩阵源代码

Description:

/*
实现效果:
1 2 6 7 15
3 5 8 14 16
4 9 13 17 22
10 12 18 21 23
11 19 20 24 25
*/
#include <stdio.h>
#define N 5 //阶数,即N*N的螺旋矩阵

void main()
{
    int i, j, num=1, a[N][N];
    for(i=0; i<=N/2; i++)
    {
        for(j=i; j<N-i; j++) a[i][j]=n++;
        for(j=i+1; j<N-i; j++) a[j][N-i-1]=n++;
        for(j=N-i-2; j>i; j--) a[N-i-1][j]=n++;
        for(j=N-i-1; j>i; j--) a[j][i]=n++;
    }
    for(i=0; i<N; i++)
    {
        for(j=0; j<N; j++)
            printf("%2d ",a[i][j]);
        printf("\n");
    }
}
    

 

不知道叫什么,先叫它“回宫图”吧
年初的时候在贴吧瞎逛,看到了一个程序挺有意思,会输出如下的形状:
01 24 23 22 21 20 19
02 25 40 39 38 37 18
03 26 41 48 47 36 17
04 27 42 49 46 35 16
05 28 43 44 45 34 15
06 29 30 31 32 33 14
07 08 09 10 11 12 13
仔细看这个形状,数字是按顺序往里回旋的,觉得很有创意,可是一看源代码头就大了,
每个编程人都知道看别人的代码是很困难的,尤其像这种不知道思路的,所以也就放下
没管了。
昨天上物理课实在是没心思听,就想起这个程序,想了一节课,果然不负有心人,给弄出来了,这个是增强版的,可以输入1-10中的任意个数,然后生成图形。
先看代码,没有注释,所以不好看的懂。
#include<stdio.h>
main()
{
       int n,m,i,j,t,k=1;
       int a[11][11];
       clrscr();
       do{
       printf("please input a number(1-10):");
       scanf("%d",&n);
       }while(n<1||n>10);
       t=n+1;
       for(m=1;m<=t/2;m++)
         {
           for(i=m;i<=t-m;i++)
             {a[i][m]=k;k++;}
           for(j=m+1;j<=t-m;j++)
             {a[i-1][j]=k;k++;}
           for(i=n-m;i>=m;i--)
             {a[i][j-1]=k;k++;}
           for(j=n-m;j>=m+1;j--)
             {a[i+1][j]=k;k++;}
         }
       for(i=1;i<=n;i++)
         {
           for(j=1;j<=n;j++)
             {
               if(a[i][j]<=9) printf("0%d ",a[i][j]);
               else printf("%d ",a[i][j]);       }
           printf("\n");
         }
       getch();
}
就是这样的。


可以更简洁些:

#include<stdio.h>
main()
{
       int n,m,i,j,t,k=1;
       int a[11][11];
       clrscr();
       do{
       printf("please input a number(1-10):");
       scanf("%d",&n);
       }while(n<1||n>10);
       t=n+1;
       for(m=1;m<=t/2;m++)
         {
           for(i=m;i<=t-m;i++)
             a[i][m]=k++;
           for(j=m+1;j<=t-m;j++)
             a[i-1][j]=k++;
           for(i=n-m;i>=m;i--)
             a[i][j-1]=k++;
           for(j=n-m;j>=m+1;j--)
             a[i+1][j]=k++;
         }
       for(i=1;i<=n;i++)
         {
           for(j=1;j<=n;j++)
             {
               if(a[i][j]<=9) printf("0%d ",a[i][j]);
               else printf("%d ",a[i][j]);       }
           printf("\n");
         }
       getch();
}

 


 #include <stdio.h>
#define N 8
main(){
 int i,j,n=1,a[N][N];
 for(i=0;i<=N/2;i++){
  for(j=i;j<N-i;j++)
   a[i][j]=n++;
  for(j=i+1;j<N-i;j++)
   a[j][N-i-1]=n++;
  for(j=N-i-2;j>i;j--)
   a[N-i-1][j]=n++;
  for(j=N-i-1;j>i;j--)
   a[j][i]=n++;
 }
 for(i=0;i<N;i++){
  printf("\n\n");
  for(j=0;j<N;j++)
   printf("%5d",a[i][j]);
 }
}
 

 


                                马踏棋盘问题


#include <stdio.h>
#define N 5
void main(){
 int x,y;
 void horse(int i,int j);
 printf("Please input start position:");
 scanf("%d%d",&x,&y);
 horse(x-1,y-1);
}
void horse(int i,int j){
 int a[N][N]={0},start=0,
  h[]={1,2,2,1,-1,-2,-2,-1},
  v[]={2,1,-1,-2,2,1,-1,-2},
  save[N*N]={0},posnum=0,ti,tj,count=0;
 int jump(int i,int j,int a[N][N]);
 void outplan(int a[N][N]);
 a[i][j]=posnum+1;
 while(posnum>=0){
  ti=i;tj=j;
  for(start=save[posnum];start<8;++start){
   ti+=h[start];tj+=v[start];
   if(jump(ti,tj,a))
    break;
   ti-=h[start];tj-=v[start];
  }
  if(start<8){
   save[posnum]=start;
   a[ti][tj]=++posnum+1;
   i=ti;j=tj;save[posnum]=0;
   if(posnum==N*N-1){
    //outplan(a);
    count++;
   }
  }
  else{
   a[i][j]=0;
   posnum--;
   i-=h[save[posnum>;j-=v[save[posnum>;
   save[posnum]++;
  }
 }
 printf("%5d",count);
}
int jump(int i,int j,int a[N][N]){
 if(i<N&&i>=0&&j<N&&j>=0&&a[i][j]==0)
  return 1;
 return 0;
}
void outplan(int a[N][N]){
 int i,j;
 for(i=0;i<N;i++){
  for(j=0;j<N;j++)
   printf("%3d",a[i][j]);
  printf("\n");
 }
 printf("\n");
 //getchar();
}
用回溯法得到所有的解,但效率较低,只能算出5行5列的

 


Platform: | Size: 4395 | Author: good@588 | Hits:

[Exploit清除木马

Description: 比较全的清除木马的方法- Compared with entire elimination wooden horse method
Platform: | Size: 8372 | Author: chuxian | Hits:

[Remote ControlSpyScreen

Description: 木马(获取远程桌面)- Wooden horse (gain long-distance tabletop)
Platform: | Size: 63863 | Author: 黄臻智 | Hits:

[Exploitnetbus

Description: 大名鼎鼎的Netbus木马源程序.-the famous Trojan horse program.
Platform: | Size: 100535 | Author: 笨鸟 | Hits:

[Remote ControlHideProcess

Description: 这是我从网络上收集的一篇关于隐藏木马方法的文章,原作者已经无从考证(不好意思),该文章同时还说了如何在WINDOWS中隐藏一个进程的方法.-This is my collection from the network on a hidden Trojan horse of the article, the original author Lebensborn (sorry), the article also said the windows in a hidden way process.
Platform: | Size: 6566 | Author: 王震 | Hits:

[Firewall-Securitype5

Description: 一个用vc写的木马示例。-vc used to write a Trojan horse example.
Platform: | Size: 1258629 | Author: 范小春 | Hits:

[CommunicationNetTime

Description: 用于扫描你的电脑上所有的TCP端口的状态。利用这个功能,你可以轻松、快速的查出你的电脑上所使用的TCP端口,进而判断你的电脑是否中了木马。扫描出来的端口状态有两种:拒绝连接、接受连接。对于处于拒绝连接状态的端口,很可能是你的电脑为了与外部主机连接而使用的,通常情况下不会对你的网络安全构成威胁。而处于接受连接状态的端口,可能会对你的网络安全构成威胁,甚至很有可能是木马程序在运行!假若你想通过本端口扫描来判断你的电脑是否中了木马,在扫描时请不要运行其它网络程序,如果扫描结果还是有处于接受连接状态的端口,那请小心警惕!最好找个电脑高手来帮忙! 注意:对于137,138,139这三个TCP端口,即使这里的扫描没有给出扫描结果,也并不代表这三个端口不接受连接,通常情况下,Windows系统会开放这三个端口。你可以用“聊天客户”来测试这三个端口是否开放,具体用法如下:翻到“聊天客户”页,选择“主机列表”里的“本地主机”,将端口改为137(或138或139),单击“连接”,若出现提示“建立连接”,则端口137(或138或139)是开放的。-used to scan your computer on all the TCP port state. Using this feature, you can easily and quickly identify your computer by the use of TCP port, then your judgment on whether a computer Trojan horse. Scanning the state has two ports : connecting refused to accept connections. For refused to connect at the state port, it is very likely your computer to connect with the mainframe and external use, under normal circumstances you will not pose a threat to network security.!accept the connection status of ports, care alert! finding the best computer experts to help! Note : This three TCP 137, 138 and 139 ports, even if the scanning here is not the results of the scan, it does not mean that this does not accept three port connectivity
Platform: | Size: 369674 | Author: 李利 | Hits:

[Windows Develop帧动画

Description: 这是一个演示帧动画的例子。有一个小马在跑,适合初学者学习。-Demo of frame animation, a small running horse. For beginner.
Platform: | Size: 65295 | Author: 王宏山 | Hits:

[Windows Developpmlx

Description: 一个记录屏幕录象木马的源程序,源程序 delphi 试试看吧-This is a source code that can track the Trojan Horse of Screen Record. It can be opened in Delphi.
Platform: | Size: 167044 | Author: 章克武 | Hits:

[Other resourceHorseRaceDemo

Description: 赛马游戏 vs.net 需要LUABind-horse racing game vs.net need LUABind
Platform: | Size: 1014690 | Author: 蔡宁涛 | Hits:

[Remote ControlMinirat

Description: 自编释修改反弹木马,意思就是将这个不错的反弹木马源代码(服务端只有十几K)占为己有,做出自已的终身免杀服务端!还不快快动手吧。。。。。。 装个delphi7就可操作了,不用装什么控件,- From arranges releases the revision resilience wooden horse, the meaning is (service end only has this good resilience wooden horse source code several K) to occupy for the oneself has, makes from already the lifelong exempts kills the service end! Also not in a big hurry begins. . . . . . Installed delphi7 to be possible to operate, did not need to install any to control,
Platform: | Size: 53279 | Author: 张强 | Hits:

[Other resource行程编码,JPEG压缩编码

Description: 行程编码,JPEG压缩编码,是压缩和骗马的最好的例子-itinerary encoding, JPEG compression coding, compression and fraud is the best horse examples
Platform: | Size: 126281 | Author: 余风 | Hits:

[ActiveX/DCOM/ATL木马编写

Description: 一个木马代码,用WIN32API编写,作者:aerqa 菜鸟免试,不然后果自负-a Trojan horse code, prepared with WIN32API, Author : aerqa birdie exemption, or bear the consequences themselves
Platform: | Size: 1036022 | Author: 0133 | Hits:

[File FormatHorse-traversal-issue

Description: 马步遍历问题 问题描述:有一n×m格的棋盘,按照国际象棋的规划,马只能走“日”字型结构,设计一算法,按马的走法将棋盘每一格刚好遍历一次。-Horse traversal issue Problem Description: There is an n × m grid of the board, in accordance with the plan of chess, the horse can only take the day shaped structure, design an algorithm, according to the horse and the walk will traverse the chessboard exactly once in each grid.
Platform: | Size: 1024 | Author: 陈刚 | Hits:

[assembly languagehorse

Description: 问题描述与实验目的 给定8*8方格棋盘,求棋盘上一只马从一个位置到达另一位置的最短路径长。注意马是走“日”形的。-horse question
Platform: | Size: 1024 | Author: 打多久啊 | Hits:

[Other GamesHorse

Description: qt设计的一个赛马游戏,总共有4匹马,任意选择一匹,判断是否选择正确了-Qt design a racing game, a total of four horses, either a horse, determine whether correct
Platform: | Size: 44032 | Author: 饶琴 | Hits:

[Data structshorse-riding

Description: 数据结构,马踏棋盘问题源代码。已经编译通过,源文件内包含代码解释。-Data structures, horse riding board source of the problem.It has been compiled by the inner source file that contains code interpreter.
Platform: | Size: 2048 | Author: 李欧 | Hits:

[Browser ClientGod-horse-source

Description: 神马导航网站源码仅供大家学习交流之用。欢迎下载学习-God horse navigation website source for everyone to learn the use of communication. Welcome to download
Platform: | Size: 1733632 | Author: phillip | Hits:

[Windows DevelopPregunta01

Description: Brief description of Backtracking Algorithm (The Horse)
Platform: | Size: 4096 | Author: alvaro4356 | Hits:
« 1 2 3 4 56 7 8 9 10 ... 50 »

CodeBus www.codebus.net