Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
谁能告诉我这个程序为什么错了#include <iostream> #include <cmath> #include <algorithm> using namespace std; int n, p; int const MAX = 100; int adj[MAX][MAX]; int list[MAX*MAX]; int main(){ int cases; cin>>cases; for(int c = 0; c < cases; c++) { cout<<"Scenario #"<<c+1<<':'<<endl; cin>>p>>n; for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) { cin>>adj[i][j]; adj[i][j] &= 0xfffffff; } //Floyd algorithm for(i = 0; i < n; i++) for(int j = 0; j < n; j++) for(int k = 0; k < n; k++) if(adj[i][k] + adj[k][j] < adj[i][j]) adj[i][j] = adj[i][k] + adj[k][j]; int t = 0; for(i = 0; i < n; i++) for(int j = 0; j < n; j++) if(i != j) list[t++] = adj[i][j]; sort(list, list + t); int index = ceil(t * p / 100.0) -1; cout<<list[index]<<endl<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator