c#问下为什么全是RE
查看原帖
c#问下为什么全是RE
674418
M123Y456lll楼主2022/1/28 19:18

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);
    }
    }

}

2022/1/28 19:18
加载中...