TOPIC

Why "Wrong Answer" ?

Syed Rafsan Raiyan asked 1 year ago

include <bits/stdc++.h>

using namespace std;

int main() { string SIGN; int SUM = 0, T;

for( T = 1; T <= 3; T++ )
{
    SUM = 0;

    while(1)
    {
        cin  >> SIGN;

        if( SIGN[0] == 'c' )
        {
            cout << SUM << endl;
            break;
        }

        if( SIGN[0] == '*' )
            SUM += 4;
        else
            SUM += 0;
        if( SIGN[1] == '*' )
            SUM += 2;
        else
            SUM += 0;
        if( SIGN[2] == '*' )
            SUM += 1;
        else
            SUM += 0;
    }

}

return 0;

}

This topic was solved and cannot recieve new replies.

  • feodorv replied 1 year ago

    Did you use uDebug to check your output? Hint: you can't just add 4 or 2 or 1.