c#问下为什么全是RE

P1001 A+B Problem

M123Y456lll @ 2022-01-28 19:18:39

using System; namespace A { class Program {

    static void Main(string [] args)
    {
        string A, B;
        int at;
        int i,j;
        int count=0;
        A = Console.ReadLine();
        B = Console.ReadLine();
        char[] a = A.ToCharArray();
        char[] b = B.ToCharArray();
        string c ="";
            for (i = a.Length - 1,j = b.Length - 1; i >= 0||j >=0; i--,j--)
            {
            if (i < 0)
            { at = Convert.ToInt32(b[j].ToString()) + count; }
            else if (j < 0)
            { at = Convert.ToInt32(a[i].ToString()) + count; }
            else
            { at = Convert.ToInt32(a[i].ToString()) + Convert.ToInt32(b[j].ToString()) + count; }
            if (at < 10)
            {
                count = 0;
            }
            else 
            {
                count = (at / 10) % 10;
                at = at % 10;
            }
            c=at+""+c;
            }
            if (count != 0)
            c =  "1" +""+ c;
            Console.WriteLine(c);
    }
    }

}


by WYXkk @ 2022-01-28 19:21:48

@lao_ba 首先,他用的是C#,不是C


by bmh_0704_chbzyx @ 2022-01-28 19:24:51

不要作死啦,大哥


by M123Y456lll @ 2022-01-28 19:33:43

@cby250 只是问下为什么不对


by M123Y456lll @ 2022-01-28 19:39:25

@cby250 我还以为是大数运算,最简单的c代码过了...


by M123Y456lll @ 2022-01-28 19:44:56

@M123Y456lll 不过还是想问下为什么不对-


|