Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

哪位高手帮我看看,总是wrong answer,谢过了

Posted by demien at 2012-12-04 18:58:27 on Problem 3749
#include <stdio.h>
#include <string.h>

char decode(char target);
char* clear(char* target);

int main(void){
        char formatted_string[100][200];
        char current_word[100];
        char decode_current_word[100];
        char current_line[200] = "\0";
        int i;
        int line =0;

        while(strcmp(current_word,"ENDOFINPUT")){
                scanf("%s",current_word);
                if(!strcmp(current_word,"START")){
                        continue;
                }else if(!strcmp(current_word,"END")){
                        strcpy(formatted_string[line],current_line);
                        line++;
                        current_line[0] = '\0';
                }else if(!strcmp(current_word,"ENDOFINPUT")){
                        continue;
                }else{
                        for(i=0;current_word[i] != '\0';i++){
                                if((64<current_word[i]) && (current_word[i]<91)) decode_current_word[i] = decode(current_word[i]);
                                else {
                                        decode_current_word[i] = current_word[i];
                                }
                        }

                        decode_current_word[i] = '\0';
                        strcat(current_line,decode_current_word);
                        strcat(current_line," ");
                        decode_current_word[0] = '\0';
                }
        }

        for(i=0;i<3;i++){
                printf("%s\n",formatted_string[i]);
        }
}

char decode(char target){
        if(target < 70) return target+21;
        else return target-5;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator