#26018: 請問為何TLE?


justinli (安茲 烏爾 恭)


#include<iostream>
using namespace std;
int main()
{
    ios_base::sync_with_stdio0 );
    cin.tie0 );

    int t;

    cin >> t;

    whilet-- )
    {
        int n , sum1 = 0 , sum2 = 0;

        forint i = 0 ; i < 4 ; i++ )
        {
            cin >> n;

            forint j = 3 ; j >= 0 ; j-- )
            {
                ifj % 2 )  sum2 += n % 10;

                else
                {
                    int x = 2 * ( n % 10 );

                    sum1 += ( x / 10 ) + ( x % 10 );
                }
                    n /= 10;
            }
        }

        if( ( sum1 + sum2 ) % 10 )  cout << "Invalid" << endl;

        else cout << "Valid" << endl;
    }
        return 0;
}
#26132: Re:請問為何TLE?


justinli (安茲 烏爾 恭)


沒事了, 我換全域變數 + "/n",就過了

#26146: Re:請問為何TLE?


justinli (安茲 烏爾 恭)


沒事了, 我換全域變數 + "/n",就過了


是"\n"才對,打錯了