| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 20105 人关注过本帖, 2 人收藏
标题:★☆发布简易语法高亮(第9版0719更新,通用免费版本,附部分源代码)☆★
只看楼主 加入收藏
kkqq
Rank: 1
等 级:新手上路
帖 子:77
专家分:0
注 册:2008-2-15
收藏
得分:0 
飞燕姐~~那代码的解压密码是什么呀?~~
不知道如何解压~~
2008-05-24 19:09
liujian885
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-8-23
收藏
得分:0 
既然发了代码怎么又不发解压密码?
2008-05-24 21:03
Hunt
Rank: 1
等 级:新手上路
威 望:1
帖 子:199
专家分:9
注 册:2004-11-23
收藏
得分:0 
源代码需要密码才能解压

程序人生最高境界:“我就是程序,程序就是我。”
2008-05-25 00:10
wzhings
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2007-1-16
收藏
得分:0 
/*****************************************************************
** HighlightCodeV3.0 software by yzfy(雨中飞燕) [url]http://[/url] **
*****************************************************************/
#include <cstdio>
#include <vector>
#include <deque>
using namespace std;
//-----------------------------------------------
typedef struct road // list
{
    int v;
    road *next;
}road;
//-----------------------------------------------
vector<road> vec;
const int N = 10005;
int level[N];
//-----------------------------------------------
void Join( int v, int w ) // add edge
{
    road *p = new road;
    p->v = w;
    p->next = vec[v].next; vec[v].next = p;   
}
//-----------------------------------------------
void bfs( int s, int e ) //bfs
{
    deque<int> q;
    q.push_back(s);
    while( !q.empty() )
    {
        int t = q[0];
        road *p = vec[t].next;
        while( p != NULL )
        {
            if( level[p->v] || p->v == s ) { p = p->next; continue; }
            level[p->v] = level[t] + 1;
            if( p->v == e ) break;
            q.push_back( p->v ); p = p->next;   
        }   
        q.pop_front(); delete p;
    }
    q.clear();
}
//-----------------------------------------------
int main()
{
    int n, k, i;
    while( scanf( "%d%d", &n, &k ), n || k ) // input
    {
        for( i = 0; i <= n; i++ ) // init
        {
                road r;
            r.v = i; r.next = NULL;
            vec.push_back( r ); level[i] = 0;     
        }
        for( i = 0; i < k; i++ ) // input and add edge
        {
            int a, b;
            scanf( "%d%d", &a, &b );
            Join( a, b ); Join( b, a );
        }   
        int s, e;
        scanf( "%d%d", &s, &e );
        if( s == e ) { puts("0"); vec.clear(); continue; }
        bfs( s, e );
        if( level[e] == 0 ) puts( "No solution" ); // output
        else printf( "%d\n", level[e] - 1 );
        vec.clear();
    }
    return 0;
}

在我的眼里,这个世界是由0和1组成的!~
2008-05-25 00:40
wzhings
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2007-1-16
收藏
得分:0 
#include <cstdio>

const int MAX=30;
int a[MAX][MAX];

void s(int x, int y, int m) {
        int r=0, t=0, i;
        while(true) {
                for(i=r; i<=y; i++)
                        a[r][i]=++t;
                if(t==m)
                        break;
                r++;
                for(i=r; i<=x; i++)
                        a[i][y]=++t;
                if(t==m)
                        break;
                for(i=y-1; i>=r-1; i--)
                        a[x][i]=++t;
                if(t==m)
                        break;
                x--;
                for(i=x; i>=r; i--)
                        a[i][r-1]=++t;
                if(t==m)
                        break;
                y--;
        }
}

void n(int x, int y, int m) {
        int r=0, t=0, i;
        while(true) {
                for(i=r; i<=x; i++)
                        a[i][r]=++t;
                if(t==m)
                        break;
                r++;
                for(i=r; i<=y; i++)
                        a[x][i]=++t;
                if(t==m)
                        break;
                for(i=x-1; i>=r-1; i--)
                        a[i][y]=++t;
                if(t==m)
                        break;
                x--;
                for(i=y-1; i>=r; i--)
                        a[r-1][i]=++t;
                if(t==m)
                        break;
                y--;
        }
}

int main() {
        int x, y, t, m;
        
        while(scanf("%d%d%d",&x,&y,&t) != EOF) {
                m=x*y;
                if(t)
                        s(--y,--x,m);
                else
                        n(--y,--x,m);
               
                for(t=0; t<=y; t++) {
                        for(m=0; m<=x; m++)
                                printf("%4d", a[t][m]);
                        printf("\n");
                }
               
                printf("\n");
        }
        
        return 0;
}



#include "stdio.h"
int main()
{
    int i,j,t;
    while(scanf("%d%d%d",&i,&j,&t)!=EOF){
          int n=1,h=0,s=0, k[31][31]={{},{}};
          while(!t){
                   k[h][s]=n++;
                   if(h<=(i+1)/2 && s<j-1 && k[h][s+1]==0 && (h<1 ||k[h-1][s]!=0))s++;
                   else if((s>=(j/2)) && h<i-1 && k[h+1][s]==0)h++;
                   else if(s>0 && k[h][s-1]==0)s--;
                   else if(h>0 && k[h-1][s]==0)h--;
                   else break;
                   }
          while(t){
                   k[h][s]=n++;
                   if(s<=(j+1)/2 && h<i-1 && k[h+1][s]==0 && (s<1 || k[h][s-1]!=0))h++;
                   else if(h>=(i/2)&& s<j-1 && k[h][s+1]==0)s++;
                   else if(h>0 && k[h-1][s]==0)h--;
                   else if(s>0 && k[h][s-1]==0)s--;
                   else break;
                   }
          for(s=0;s<j;s++){
            for(h=0;h<i;h++){
               printf("%4d",k[h][s]);
               }
            printf("\n");
            }
          printf("\n");
          }
    return 0;
}

#include "stdio.h"
int main()
{
    int i,j,t;
    while(scanf("%d%d%d",&j,&i,&t)!=EOF){
          int n=1,h=0,s=0, k[31][31]={{},{}};
          i--;j--;
          while(t){
                   k[s][h]=n++;
                   if((h>=s || k[s-1][h]!=0) && h<j && k[s][h+1]==0 )h++;
                   else if( s<i && k[s+1][h]==0)s++;
                   else if( h>0 && k[s][h-1]==0)h--;
                   else if( s>0 && k[s-1][h]==0)s--;
                   else break;
                   }
          while(!t){
                    k[s][h]=n++;
                   if((s>=h || k[s][h-1]!=0) && s<i && k[s+1][h]==0 )s++;
                   else if( h<j && k[s][h+1]==0)h++;
                   else if( s>0 && k[s-1][h]==0)s--;
                   else if( h>0 && k[s][h-1]==0)h--;
                   else break;
                   }
          for(s=0;s<=i;s++){
            for(h=0;h<=j;h++){
               printf("%4d",k[s][h]);
               }
            printf("\n");
            }
          printf("\n");
          }
    return 0;
}

在我的眼里,这个世界是由0和1组成的!~
2008-05-25 00:44
wzhings
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2007-1-16
收藏
得分:0 
/*****************************************************************
** HighlightCodeV3.0 software by yzfy(雨中飞燕) [url]http://[/url] **
*****************************************************************/
#include <stdio.h>
#include <conio.h>
int main()
{
printf("Computer Science");
getch();
return 0;
}



原来真的是要除了代码,还得加点儿东西才能"不小于3个字符"!!!!!!!!
[[it] 本帖最后由 wzhings 于 2008-5-25 01:02 编辑 [/it]]

[[it] 本帖最后由 wzhings 于 2008-5-25 01:03 编辑 [/it]]

在我的眼里,这个世界是由0和1组成的!~
2008-05-25 00:49
wzhings
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2007-1-16
收藏
得分:0 
/*****************************************************************
** HighlightCodeV3.0 software by yzfy(雨中飞燕) [url]http://[/url] **
*****************************************************************/
#include <cstdio>

const int MAX=30;
int a[MAX][MAX];

void s(int x, int y, int m) {
        
int r=0, t=0, i;
        while(true) {
               
for(i=r; i<=y; i++)
                        a[r][i]=++t;
                if(t==m)
                        break;
                r++;
                for(i=r; i<=x; i++)
                        a[i][y]=++t;
                if(t==m)
                        break;
                for(i=y-1; i>=r-1; i--)
                        a[x][i]=++t;
                if(t==m)
                        break;
                x--;
                for(i=x; i>=r; i--)
                        a[i][r-1]=++t;
                if(t==m)
                        break;
                y--;
        }
}

void n(int x, int y, int m) {
        
int r=0, t=0, i;
        while(true) {
               
for(i=r; i<=x; i++)
                        a[i][r]=++t;
                if(t==m)
                        break;
                r++;
                for(i=r; i<=y; i++)
                        a[x][i]=++t;
                if(t==m)
                        break;
                for(i=x-1; i>=r-1; i--)
                        a[i][y]=++t;
                if(t==m)
                        break;
                x--;
                for(i=y-1; i>=r; i--)
                        a[r-1][i]=++t;
                if(t==m)
                        break;
                y--;
        }
}

int main() {
        
int x, y, t, m;
        
        while(scanf("%d%d%d",&x,&y,&t) != EOF) {
               
m=x*y;
                if(t)
                        s(--y,--x,m);
                else
                        
n(--y,--x,m);
               
                for(t=0; t<=y; t++) {
                        
for(m=0; m<=x; m++)
                                printf("%4d", a[t][m]);
                        printf("\n");
                }
               
               
printf("\n");
        }
        
        
return 0;
}



#include "stdio.h"
int main()
{
   
int i,j,t;
    while(scanf("%d%d%d",&i,&j,&t)!=EOF){
            
int n=1,h=0,s=0, k[31][31]={{},{}};
            while(!t){
                    
k[h][s]=n++;
                    if(h<=(i+1)/2 && s<j-1 && k[h][s+1]==0 && (h<1 ||k[h-1][s]!=0))s++;
                    else if((s>=(j/2)) && h<i-1 && k[h+1][s]==0)h++;
                    else if(s>0 && k[h][s-1]==0)s--;
                    else if(h>0 && k[h-1][s]==0)h--;
                    else break;
                    }
            
while(t){
                    
k[h][s]=n++;
                    if(s<=(j+1)/2 && h<i-1 && k[h+1][s]==0 && (s<1 || k[h][s-1]!=0))h++;
                    else if(h>=(i/2)&& s<j-1 && k[h][s+1]==0)s++;
                    else if(h>0 && k[h-1][s]==0)h--;
                    else if(s>0 && k[h][s-1]==0)s--;
                    else break;
                    }
            
for(s=0;s<j;s++){
            
for(h=0;h<i;h++){
               
printf("%4d",k[h][s]);
                }
            
printf("\n");
            }
            
printf("\n");
            }
   
return 0;
}

#include "stdio.h"
int main()
{
   
int i,j,t;
    while(scanf("%d%d%d",&j,&i,&t)!=EOF){
            
int n=1,h=0,s=0, k[31][31]={{},{}};
            i--;j--;
            while(t){
                    
k[s][h]=n++;
                    if((h>=s || k[s-1][h]!=0) && h<j && k[s][h+1]==0 )h++;
                    else if( s<i && k[s+1][h]==0)s++;
                    else if( h>0 && k[s][h-1]==0)h--;
                    else if( s>0 && k[s-1][h]==0)s--;
                    else break;
                    }
            
while(!t){
                    
k[s][h]=n++;
                    if((s>=h || k[s][h-1]!=0) && s<i && k[s+1][h]==0 )s++;
                    else if( h<j && k[s][h+1]==0)h++;
                    else if( s>0 && k[s-1][h]==0)s--;
                    else if( h>0 && k[s][h-1]==0)h--;
                    else break;
                    }
            
for(s=0;s<=i;s++){
            
for(h=0;h<=j;h++){
               
printf("%4d",k[s][h]);
                }
            
printf("\n");
            }
            
printf("\n");
            }
   
return 0;
}



在我的眼里,这个世界是由0和1组成的!~
2008-05-25 01:05
njinji007
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2008-4-14
收藏
得分:0 
谢谢楼主.
2008-05-25 01:42
StarWing83
Rank: 8Rank: 8
来 自:仙女座大星云
等 级:贵宾
威 望:19
帖 子:3951
专家分:748
注 册:2007-11-16
收藏
得分:0 
顶一个~~~~
发现还是新版本的好啊……

专心编程………
飞燕算法初级群:3996098
我的Blog
2008-05-29 15:12
思考ING
Rank: 1
来 自:重庆
等 级:新手上路
帖 子:140
专家分:0
注 册:2008-3-12
收藏
得分:0 
解压密码~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

天生孤独的思考~~~~~~~~~
2008-05-29 18:52
快速回复:★☆发布简易语法高亮(第9版0719更新,通用免费版本,附部分源代码) ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.031474 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved