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 |
求救!!那位高手知道我这题为什么output limit exceed(附代码)#include<iostream> using namespace std; char pk[4][13][3]; char x,y; void set(int a,int b,int c,int d) { int i; for(i = 0;i < 6;i ++) { cin >> x >> y; pk[a][i][0] = x;pk[a][i][1] = y; cin >> x >> y; pk[b][i][0] = x;pk[b][i][1] = y; cin >> x >> y; pk[c][i][0] = x;pk[c][i][1] = y; cin>> x >> y; pk[d][i][0] = x;pk[d][i][1] = y; } cin >> x >> y; pk[a][i][0] = x;pk[a][i][1] = y; cin >> x >> y; pk[b][i][0] = x;pk[b][i][1] = y; getchar(); cin >> x >> y; pk[c][i][0] = x;pk[c][i][1] = y; cin>> x >> y; pk[d][i][0] = x;pk[d][i][1] = y; for(i ++;i < 13;i ++) { cin >> x >> y; pk[a][i][0] = x;pk[a][i][1] = y; cin >> x >> y; pk[b][i][0] = x;pk[b][i][1] = y; cin >> x >> y; pk[c][i][0] = x;pk[c][i][1] = y; cin>> x >> y; pk[d][i][0] = x;pk[d][i][1] = y; } } int main() { char pp[15][3];int i,j,k,v[13],vv[13],change,t; char c,s[5] = "SWNE"; cin >> c; while(c!='#'){ for(i = 0;i < 4&&c!=s[i];i++); i++; set(i,(i+1)%4,(i+2)%4,(i+3)%4); for(i = 0;i < 4;i ++) { memset(v,0,sizeof(v)); for(k = 0;k < 13;k ++) { switch(pk[i][k][0]){ case 'C': v[k] += 20;break; case 'D': v[k] += 40;break; case 'S': v[k] += 60;break; case 'H': v[k] += 80;break; } if(pk[i][k][1] < 'A') v[k] += pk[i][k][1] - '0'; else switch(pk[i][k][1]){ case 'T': v[k] += 10;break; case 'J': v[k] += 11;break; case 'Q': v[k] += 12;break; case 'K': v[k] += 13;break; case 'A': v[k] += 15;break; } } for(k = 0;k < 13;k ++)vv[k] =k; for(j = 0,change = 1;j < 13&&change;j ++) { change = 0; for(k = 0;k < 12-j;k ++) if(v[k]>v[k+1]) { t = v[k];v[k] = v[k+1];v[k+1] = t; t = vv[k];vv[k] = vv[k+1];vv[k+1] = t;change = 1; } } for(j = 0;j < 13;j ++) { pp[j][0] = pk[i][vv[j]][0];pp[j][1] = pk[i][vv[j]][1]; } switch(i){ case 0: cout << "South Player:\n";break; case 1: cout << "West Player:\n";break; case 2: cout << "North Player:\n";break; case 3: cout << "East Player:\n";break; } cout << "+---+---+---+---+---+---+---+---+---+---+---+---+---+\n"; for( j = 0;j < 13;j ++) { cout << '|'<< pp[j][1] << ' ' << pp[j][1]; }cout <<"|\n"; for(j = 0;j < 13;j ++) { cout << "| "<<pp[j][0]<<' ' ; }cout << "|\n"; for(j = 0;j < 13;j ++) { cout << '|'<< pp[j][1] << ' ' << pp[j][1]; }cout <<"|\n"; cout << "+---+---+---+---+---+---+---+---+---+---+---+---+---+\n"; } cout << endl; cin >> c; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator