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 |
怎么总是wa呀!!!倒是没有pe。。。。。#include <iostream> #include<cstdlib> using namespace std; char a[10000][256]; int main() { freopen("2271in.txt","r",stdin); freopen("2271out.txt","w",stdout); int many=0,ji; while (gets(a[many])!=NULL) many+=1; ji=0; for (int i=0;i<many;i++) { int c,w; char b[100]; memset(b,0,sizeof(b)); w=-1; c=strlen(a[i]); for (int j=0;j<c;j++) { if (a[i][j]!=' ') { w+=1; b[w]=a[i][j]; // printf("%s %c\n",b,a[i][j]); // system("pause"); } else { if (w!=-1) if ((strcmp(b,"<br>")!=0)&&(strcmp(b,"<hr>")!=0)) { // printf("1:%s\n",b); if (w+1<80-ji) { b[w+1]='\0'; if (ji==0) printf("%s",b); else {printf(" %s",b); ji+=1;} ji+=w+1; w=-1; memset(b,0,sizeof(b)); } else {b[w+1]='\0'; printf("\n"); printf("%s",b); ji=w+1; memset(b,0,sizeof(b)); w=-1; }} else {//printf("2:%s\n",b); if (strcmp(b,"<br>")==0) {printf("\n");ji=0;memset(b,0,sizeof(b));w=-1;} else { if (ji!=0) {printf("\n");} for (int k=1;k<=80;k++) printf("-"); ji=80; memset(b,0,sizeof(b)); w=-1; } } } } if (w!=-1) if ((strcmp(b,"<br>")!=0)&&(strcmp(b,"<hr>")!=0)) {if (w+1<80-ji) { //printf("1:%s\n",b); b[w+1]='\0'; if (ji==0) printf("%s",b); else {printf(" %s",b); ji+=1;} ji+=w+1; w=-1; memset(b,0,sizeof(b)); } else {b[w+1]='\0'; printf("\n"); printf("%s",b); ji=w+1; memset(b,0,sizeof(b)); w=-1; }} else { // printf("2:%s\n",b); if (strcmp(b,"<br>")==0) {printf("\n");ji=0;memset(b,0,sizeof(b));w=-1;} else { if (ji!=0) printf("\n"); for (int k=1;k<=80;k++) printf("-"); ji=80; memset(b,0,sizeof(b)); w=-1; } } } printf("\n"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator