²é¿´: 1523  |  »Ø¸´: 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µÄ»ØÌû
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[»ù½ðÉêÇë] filecode +8 documentary 2026-08-10 8/400 2026-08-10 19:20 by loufangrui
[»ù½ðÉêÇë] FileCodeÄÜ¿´³öɶ£¿ +7 ÒªÀÖ¹ÛÒ«¸ç 2026-08-10 13/650 2026-08-10 19:05 by 2000zf36392
[»ù½ðÉêÇë] ×ÛÊöÂÛÎÄ×÷Ϊ´ú±í×÷»á²»»áÓ°ÏìÆÀÉóר¼ÒµÄÓ¡Ïó·Ö£¿ +10 yufeiwaner 2026-08-09 11/550 2026-08-10 18:47 by yufeiwaner
[»ù½ðÉêÇë] ÎªÊ²Ã´ÍøÉϺܶàÈË˵±¾ÖÜ 12ºÅ³ö½á¹û +3 ˲ϢÓîÖæ 2026-08-10 3/150 2026-08-10 18:27 by Tide man
[»ù½ðÉêÇë] ¾²µÈ»ù½ð½á¹û +5 gjjjzhong 2026-08-10 16/800 2026-08-10 17:19 by Tide man
[»ù½ðÉêÇë] ÎҵĹú»ùÌáǰ֪µÀÖÐÁË£¬¿ÉÊÇͬʵIJÙ×÷ÈÃÎÒʵÔÚ½ÓÊܲ»ÁË£¬Ôõô»áÓÐÕâÑùµÄÈË +8 ¼ÒÓëÔ¶·½ 2026-08-10 11/550 2026-08-10 17:09 by ÁùÁ½·ÏÍ­
[»ù½ðÉêÇë] ¹ØÓÚFilecode·ÖÎö·½·¨ +3 majunge000 2026-08-10 3/150 2026-08-10 15:46 by lch2012
[»ù½ðÉêÇë] Ó¦¸ÃÊÇ93bebmhtakǰºóʮһ¸ö×Ö·û±È½Ï¹Ø¼ü +14 Lanmanbaby 2026-08-09 22/1100 2026-08-10 14:57 by wwncly
[»ù½ðÉêÇë] ÃæÉÏÏîÄ¿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 ÈÊÑâн´«
[»ù½ðÉêÇë] ¹ú»ù½ðµÄÉ걨Ӧ¸Ã¸Ä³É·ÇµÈ¶îÖÆ£¬ÆÀ¼Û¸ßµÄÇ®¶àÆÀ¼ÛµÍµÄÇ®ÉÙ£¬µ«ÊÇÔö¼Ó×ÊÖúÂÊ +7 a089 2026-08-07 7/350 2026-08-08 18:05 by gltch
[»ù½ðÉêÇë] ¹ØÓÚfilecode +4 ²¼²¼ºÍÒ»¶þ 2026-08-07 7/350 2026-08-07 22:55 by zhanghaozhu
[»ù½ðÉêÇë] »¯Ñ§¿Údownload_prp&amp;fileCodeµÄ¹Ì¶¨¶ÎºÃÏñÕ⼸Ììһֱû±ä£¬ÓбäµÄ´óÉñô£¿ +3 Tide man 2026-08-07 4/200 2026-08-07 22:39 by Tide man
[»ù½ðÉêÇë] ¹Ì¶¨¶ËͻȻ±äÁË£¬½ñÌì +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
[»ù½ðÉêÇë] filecode±ä»¯Çé¿ö +6 ²¼²¼ºÍÒ»¶þ 2026-08-07 22/1100 2026-08-07 14:45 by ÇÒÌý»¢Ð¥
[»ù½ðÉêÇë] filecode +8 ²¼²¼ºÍÒ»¶þ 2026-08-06 11/550 2026-08-06 20:41 by tangpu318
[»ù½ðÉêÇë] Ó°ÏìÃæÉϵÄÒòËØ +8 ²¼²¼ºÍÒ»¶þ 2026-08-05 11/550 2026-08-06 10:41 by ±¦±´³æ×Ó
[»ù½ðÉêÇë] ÓÐûÓÐH¿ÚµÄ£¿ÓÐÊÕµ½ÏûÏ¢µÄÂ𣿠+3 ³¬¼¶º£Ïº 2026-08-04 3/150 2026-08-04 17:26 by ѧ½ÌÓýµÎ
[»ù½ðÉêÇë] ´¿ÓéÀÖ£¬²»Ï²»¶ÎðÅç +7 Tide man 2026-08-04 10/500 2026-08-04 15:10 by loufangrui
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û