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

注意!!tle的也可能是这个原因

Posted by tjrac6016203284 at 2018-05-02 13:03:59 on Problem 3026
tle了一晚上,居然是在因为输入上有个坑

6 5              
######
#A#A##
# # A#
#S  ##
######

空格位于"6 5              ",得丢弃
这后面有他妈的好多空格,好想给作者寄炸弹

哎,没注意评论里大佬的提醒,提供一种存入方法,好气哦

    int T;
    char s[3000];
    scanf("%d",&T);
    getchar();
    while(T--)
    {
        init();//初始化数据
        N=0;
        M=0;
        gets(s);
        int len=strlen(s);
        int ctor=0;
        while(s[ctor]==' ')
        {
            ++ctor;
        }
        while(s[ctor]!=' ')
        {
            M=M*10+s[ctor]-'0';
            ++ctor;
        }
        while(s[ctor]==' ')
        {
            ++ctor;
        }
        while(ctor<len&&s[ctor]!=' ')
        {
            N=N*10+s[ctor]-'0';
            ++ctor;
        }
        for(int i=0;i<N;++i) gets(Map[i]);
}

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