ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1104. Don’t Ask Woman about Her Age

URGENT NEED HELP :(
Posted by Miguel Angel 5 Dec 2001 03:07
i don't know what's wrong with my program, it looks perfect
but get WA

#include<iostream.h>

#define EOLN '\n'

int res[37];

void main()
{
    int k;
    int maxk = 2;
    char c;
    for (k=2; k<=36; k++)
          res[k] = 0;
    while ((c = cin.get())!=EOLN && c!=EOF)
    {
        for (k=maxk; k<=36; k++)
        {
            int a = 0;
            if ( c >= 'A' && c<= 'Z')
                a = c - 'A' + 10;
            if ( c >= '0' && c<= '9')
                a = c - '0';
            if ( a > maxk - 1 ) maxk = a + 1;
            res[k] = (res[k]*k + a)%(k-1);
        }
    }
    for (k=maxk; k<=36; k++)
          if (res[k] == 0) break;
    if (k<=36)
        cout<<k<<endl;
    else
        cout<<"No Solution\n";
}
That's simple!
Posted by shitty.Mishka 5 Dec 2001 20:52
Just change "No Solution"  to "No solution.", and you'll
get AC.
You should be very careful and attentive when reading the
task.

Good luck!