TOPIC

Why "Wrong Answer" ?

Rafsan30 asked 4 years 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 4 years ago

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