|
|
back to boardWhat is wrong test 5 #include <cstdlib> #include <iostream> #include <string> #include <algorithm> using namespace std; int n,i,d,j; string s[505],e[505][90],w,w2,a1,a2; int main(int argc, char *argv[]) { cin>>n; for(i=0;i<n;i++) cin>>s[i]; string p; p=1; w=""; for(i=0;i<n;i++) { for(j=0;j<s[i].length();j++) if(s[i][j]=='\\') s[i][j]=1; } sort(s,s+n); for(i=0;i<n;i++) { d=0; for(j=0;j<s[i].length();j++) {w2=s[i][j]; if(w2.compare(p)==0) { d++; } else e[i][d]=e[i][d]+s[i][j]; } } for(j=0;j<80;j++) {if(e[0][j]!="") {for(d=0;d<j;d++) cout<<" "; cout<<e[0][j]<<endl;} else break; } for(i=1;i<n;i++) {a1=""; a2=""; for(j=0;j<80;j++) {a1=a1+e[i][j]; a2=a2+e[i-1][j]; if(e[i][j]=="") break; else if(a1!=a2) { a1=""; a2=""; a1=a1+e[i][j]; a2=a1+e[i-1][j]; for(d=0;d<j;d++) cout<<" "; cout<<e[i][j]<<endl;} } }
return 0; } Re: What is wrong test 5 I find your mistake.You used c++.You must use delphi.ok? Re: What is wrong test 5 Posted by Nazar 16 May 2010 10:01 Re: What is wrong test 5 I got AC |
|
|