²é¿´: 1525  |  »Ø¸´: 9
µ±Ç°Ö»ÏÔʾÂú×ãÖ¸¶¨Ìõ¼þµÄ»ØÌû£¬µã»÷ÕâÀï²é¿´±¾»°ÌâµÄËùÓлØÌû

zyj8119

ľ³æ (ÖøÃûдÊÖ)

[ÇóÖú] Ò»¸öC³ÌÐò£¬²»ÖªµÀΪɶÓÐÕâô¶à´íÎó£¿

CODE:
#include
#include

const int MAXN = 100;
const int MAXINT = 10001;
int N;
int dist[MAXN][MAXN];
int flag[MAXN][MAXN];

int main()
{
        //¶ÁÈëÊý¾Ý£¬²¢³õʼ»¯
        freopen("city.in","r",stdin);
        freopen("city.out","w",stdout);
        scanf("%d",&N);
        int i, j, d, k;
        for(i=0;i                 for(j=0;j                         scanf("%d",&dist[i][j]);
                        if(dist[i][j]<0){
                                dist[i][j] = MAXINT;
                        }
                }
        }
memset(flag,1,sizeof(flag));
for(k=0;k         for(i=0;i                 if(i==k)continue;
                for(j=0;j                         if(k==j)continue;
                        d=dist[i][k]+dist[k][j];
                        if(d<=dist[i][j]){
                                flag[i][j]=0;
                                dist[i][j]=d;
                        }
                }
        }
}
//
int acc=0;
for(i=0;i    if(flag[i][j])acc+=dist[i][j];
printf("%d\n",acc);
for(i=0;i         flag[i][i]=0;
         for(j=0;j                 if(j) printf(" ");
                printf("%d",flag[i][j]);
        }
        printf("\n");
}
return 0;
}


ΪʲôÀ©Õ¹ÃûΪ.cµÄʱºò³öÏÖÕâô¶à´íÎó£¿
--------------------Configuration: w - Win32 Debug--------------------
Compiling...
w.c
e:\x\w.c(7) : error C2057: expected constant expression
e:\x\w.c(7) : error C2466: cannot allocate an array of constant size 0
e:\x\w.c(7) : error C2057: expected constant expression
e:\x\w.c(7) : error C2466: cannot allocate an array of constant size 0
e:\x\w.c(7) : error C2087: '' : missing subscript
e:\x\w.c(8) : error C2057: expected constant expression
e:\x\w.c(8) : error C2466: cannot allocate an array of constant size 0
e:\x\w.c(8) : error C2057: expected constant expression
e:\x\w.c(8) : error C2466: cannot allocate an array of constant size 0
e:\x\w.c(8) : error C2087: '' : missing subscript
e:\x\w.c(16) : error C2143: syntax error : missing ';' before 'type'
e:\x\w.c(17) : error C2065: 'i' : undeclared identifier
e:\x\w.c(18) : error C2065: 'j' : undeclared identifier
e:\x\w.c(25) : warning C4034: sizeof returns 0
e:\x\w.c(26) : error C2065: 'k' : undeclared identifier
e:\x\w.c(31) : error C2065: 'd' : undeclared identifier
e:\x\w.c(40) : error C2143: syntax error : missing ';' before 'type'
e:\x\w.c(42) : error C2065: 'acc' : undeclared identifier
Error executing cl.exe.

w.obj - 17 error(s), 1 warning(s)
µ«ÊÇÀ©Õ¹ÃûΪ.cppȴû´í£¿
»Ø¸´´ËÂ¥

» ²ÂÄãϲ»¶

» ±¾Ö÷ÌâÏà¹Ø¼ÛÖµÌùÍÆ¼ö£¬¶ÔÄúͬÑùÓаïÖú:

ºÃºÃѧϰ£¬ÌìÌìÏòÉÏ¡£
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

΢³¾¡¢ÃÎÏë

ľ³æ (ÖªÃû×÷¼Ò)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¡ï
ÓàÔó³É(½ð±Ò+1): лл²ÎÓëÓ¦Öú£¡ 2011-12-02 17:26:30
¿´ÄǸöºÚÉ«¼Ó´ÖµÄ×ÖÌ壬ԭÀ´ÊDZàÒëΪC++´úÂë~
ÈηçÔÆ±ä»Ã£¬ÎÒЦ¶ÔÈËÉú£¡
9Â¥2011-11-27 20:08:19
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
²é¿´È«²¿ 10 ¸ö»Ø´ð

crystal5288

Ìú³æ (СÓÐÃûÆø)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¡ï
jjdg(½ð±Ò+1): ¸Ðл²ÎÓë 2011-11-28 01:17:28
ÒýÓûØÌû:
1Â¥: Originally posted by zyj8119 at 2011-11-27 16:38:38:
[code]#include<stdio.h>
#include<string.h>

const int MAXN = 100;
const int MAXINT = 10001;
int N;
int dist[MAXN][MAXN];
int flag[MAXN][MAXN];

int main()
{
        //¶ÁÈëÊý ...

Õâ¶¼ÊǺܼòµ¥µÄ´íÎó£¬×Ô¼ººÃºÃ¿´¿´£¡
2Â¥2011-11-27 16:55:04
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

Â̱éɽԭ

Í­³æ (СÓÐÃûÆø)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

¡ï
jjdg(½ð±Ò+1): ¸Ðл²ÎÓë 2011-11-28 01:17:36
const¹Ø¼ü×ֺͺ¯ÊýÄÚ²¿¶¨Òå±äÁ¿¶¼ÔÚc99ÀïÃæ¡£
Òª‰ôß[£¬²»Òª´ßÃß¡£
3Â¥2011-11-27 18:27:10
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

Â̱éɽԭ

Í­³æ (СÓÐÃûÆø)

¡¾´ð°¸¡¿Ó¦Öú»ØÌû

jjdg: ¸Ðл²ÎÓë 2011-11-28 01:17:42
µ«ÊÇcÀïÃæ²»ÄÜÕâôд
const int MAXN = 100;
int dist[MAXN][MAXN];
int flag[MAXN][MAXN];
c++ºÍfortran¿ÉÒÔ£¬Èç¹ûÒªcµÄ»°¿ÉÒÔÓúꡣ
Òª‰ôß[£¬²»Òª´ßÃß¡£
4Â¥2011-11-27 18:30:23
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[»ù½ðÉêÇë] ÎªÊ²Ã´ÍøÉϺܶàÈË˵±¾ÖÜ 12ºÅ³ö½á¹û +4 ˲ϢÓîÖæ 2026-08-10 4/200 2026-08-11 02:02 by ÅÔ¹Û2020
[»ù½ðÉêÇë] »ù½ðÖÐÁË +15 laoda193707 2026-08-06 15/750 2026-08-11 00:11 by jiafei2190
[»ù½ðÉêÇë] Сľ³æÉÏÕâô¶àÂôÂÛÎĵģ¬ÕæÓÐÈËÂòÂÛÎÄô£¿¸Ð¾õû±ØÒª°¡ +3 Tide man 2026-08-10 3/150 2026-08-10 21:48 by GZUZM
[»ù½ðÉêÇë] È·¶¨ÁË£¬¹ú×ÔÈ»21ºÅ·Å°ñ +6 ²¼²¼ºÍÒ»¶þ 2026-08-10 7/350 2026-08-10 19:15 by 2000zf36392
[»ù½ðÉêÇë] ¹ØÓÚFilecode·ÖÎö·½·¨ +3 majunge000 2026-08-10 3/150 2026-08-10 15:46 by lch2012
[»ù½ðÉêÇë] ¹ú×ÔÈ»½á¹û +4 Vierhys 2026-08-10 8/400 2026-08-10 15:06 by Vierhys
[»ù½ðÉêÇë] Ææ¹Ö£¬Á½¸öÈ˵Äfilecode¹Ì¶¨¶Î´ÓÍ·µ½Î²Ò»Ä£Ò»Ñù +4 ²¼²¼ºÍÒ»¶þ 2026-08-10 4/200 2026-08-10 14:50 by ҽѧÀÏÄк¢
[»ù½ðÉêÇë] ÃæÉÏÏîÄ¿filecodeаÐÞ +5 Î÷ɽʮÔ 2026-08-09 7/350 2026-08-10 07:32 by ÈÊÑâн´«
[»ù½ðÉêÇë] fileCodeÓÐнâ¶Á£¿ +10 Tide man 2026-08-08 18/900 2026-08-09 12:55 by ÈÊÑâн´«
[»ù½ðÉêÇë] ¹ØÓÚfilecode£¬ºÜ¸ºÔðÈεĸæËß´ó¼Ò +6 °®¿´ÊéµÄ¿ÉÀÖ 2026-08-08 7/350 2026-08-08 22:13 by a_niu
[»ù½ðÉêÇë] ¹ØÓÚ¶¹Ò¯»Ø´ðµÄJTJCÓë%2FÊýÁ¿ +5 yang182083 2026-08-06 7/350 2026-08-08 18:29 by zhanghaozhu
[»ù½ðÉêÇë] ¹ØÓÚfilecode +4 ²¼²¼ºÍÒ»¶þ 2026-08-07 7/350 2026-08-07 22:55 by zhanghaozhu
[»ù½ðÉêÇë] ¹Ì¶¨¶ËͻȻ±äÁË£¬½ñÌì +6 archvillain 2026-08-06 10/500 2026-08-07 16:03 by ҽѧÀÏÄк¢
[»ù½ðÉêÇë] Ìý˵½ñÌìfilecode±äÁË +24 ²¼²¼ºÍÒ»¶þ 2026-08-06 47/2350 2026-08-07 16:02 by zhiyanjiang
[»ù½ðÉêÇë] ´ó¼ÒÉ¢Á˰ɣ¬ºó׺Ñо¿Ã»ÓÐÒâÒ壬±ðÀË·Ñʱ¼äÁË£¬¹ýºÃĿǰµÄÿһÌ죬²»Òª½¹ÂÇ +5 Tide man 2026-08-06 7/350 2026-08-07 13:11 by ҽѧÀÏÄк¢
[»ù½ðÉêÇë] filecode +14 µÈ´ý½âµÄÃÕ 2026-08-06 19/950 2026-08-07 12:20 by wlwhappy
[»ù½ðÉêÇë] Çó¸÷λ´óÉñ¿´Ï 100+6 hpkpkpkp 2026-08-05 33/1650 2026-08-06 14:49 by zhiyanjiang
[»ù½ðÉêÇë] Ó°ÏìÃæÉϵÄÒòËØ +8 ²¼²¼ºÍÒ»¶þ 2026-08-05 11/550 2026-08-06 10:41 by ±¦±´³æ×Ó
[»ù½ðÉêÇë] ºÃÏûÏ¢£¿Õâ¸öÓкκ¬Ò壿£¿£¿ +8 Tide man 2026-08-05 10/500 2026-08-05 16:14 by xmuxiaoyu
[»ù½ðÉêÇë] ÓÐûÓÐH¿ÚµÄ£¿ÓÐÊÕµ½ÏûÏ¢µÄÂ𣿠+3 ³¬¼¶º£Ïº 2026-08-04 3/150 2026-08-04 17:26 by ѧ½ÌÓýµÎ
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û