为什么codechef不接受这个? [英] Why is codechef not accepting this?

查看:111
本文介绍了为什么codechef不接受这个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比赛页面| CodeChef [ ^ ]



我尝试了什么:



Contest Page | CodeChef[^]

What I have tried:

#include<stdio.h>
int main()
{
    int i,j,T;
    int c1[20],c2[20];
    char s[20][100000];

    scanf("%d",&T);

    for(i=0;i<T;i++)
    {
        c1[i]=0;
        c2[i]=0;
    }

    for(i=0;i<T;i++)
        scanf("%s",s[i]);
    for(i=0;i<=T-1;i++)
    { 
        for(j=0;s[i][j]!='\0';j++)
        {  
            if(s[i][j]=='A')
            { 
                c1[i]++;
            }
            else if(s[i][j]=='B')
            {
                c2[i]++;                
            }    
            else if(s[i][j]=='.') 
            {
                if(s[i][j+1]=='A'&&s[i][j-1]=='A')
                    c1[i]=c1[i]+1;
                else if (s[i][j+1]=='B'&&s[i][j-1]=='B')
                    c2[i]=c2[i]+1;
            }
        }
    }

    for(i=0;i<T;i++)
        printf("%d %d\n",c1[i],c2[i]);
}

推荐答案

这是一个转贴,唯一的修改是你在第一个问题中给出的更正。

我真的不知道如何进一步改善这个 [ ^ ]



正如您已经被告知的那样,使用调试器查看您的代码正在做什么。



您的代码失败,因为您的算法错误。

作为程序员,您的工作是创建算法解决特定问题而您不能依赖某人否则永远为你做,所以有一段时间你将不得不学习如何。越快越好。
This is a repost, the only changes done are the corrections you have been given in first question.
I seriously donno HOW to IMPROVE THIS FURTHER[^]

As you have already been told, use the debugger to see what your code is doing.

Your code fail because your algorithm is wrong.
As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.


他们告诉你为什么结果指标是你的红色X:

They are telling you why with the result indicator which is a red X in your case:
引用:

错误答案

您的程序已成功编译并成功运行,但输出与预期输出不匹配。

Wrong Answer
Your program compiled and ran succesfully but the output did not match the expected output.


它没有被接受可能是因为没有产生预期的输出。



如果你正在寻找有人为你调试你的代码,这不会发生,因为你不会学到任何东西。
It's not being accepted probably because the expected output isn't being produced.

If you were looking for someone to debug your code for you, that's not going to happen as you wouldn't learn anything.


这篇关于为什么codechef不接受这个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆