标签:display str scan ++ string while return else lse
1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 using namespace std; 5 6 const int maxn = 1010; 7 double a[maxn][maxn]; 8 9 int main() 10 { 11 int m,n; 12 while(scanf("%d",&n )!=EOF) 13 { 14 for(int i=0; i<n; i++) 15 { 16 for(int j=0; j<n; j++) 17 { 18 scanf("%lf",&a[i][j] ); 19 } 20 } 21 for(int k=0; k<n; k++) 22 for(int i=0; i<n; i++) 23 for(int j=0; j<n; j++) 24 if(a[i][j]<(a[i][k]*a[k][j])) 25 a[i][j]=a[i][k]*a[k][j]; 26 scanf("%d",&m ); 27 for(int i=0; i<m; i++) 28 { 29 int x,y; 30 scanf("%d%d",&x,&y ); 31 if(a[x-1][y-1]!=0) 32 printf("%.3lf\n",a[x-1][y-1]); 33 else 34 printf("What a pity!\n"); 35 } 36 } 37 38 return 0; 39 }
只有不断学习才能进步!
标签:display str scan ++ string while return else lse
原文地址:https://www.cnblogs.com/wenbao/p/5730034.html