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 1567. SMS-spam

WA on Test#8!
Posted by ░▒▓ Nguyễn Kim Vỹ ▓▒░ 19 Jul 2010 04:26
Please tell me why this program give WA on test8, thanks!
#include <iostream>
using namespace std;
void main()
{
    int sum=0;
    char s[1000];
    first:
    while(cin.getline(s,1000))
    {
        for(int i=0;i<strlen(s);i++)
        {
            switch(s[i])
            {
                case'a':case'd':case'g':case'j':case'm':case'p':case's':case'v':case'y':case'.':case' ':
                    sum+=1;
                    break;
                case'b':case'e':case'h':case'k':case'n':case'q':case't':case'w':case'z':case',':
                    sum+=2;
                    break;
                case'c':case'f':case'i':case'l':case'o':case'r':case'u':case'x':case'!':
                    sum+=3;
                    break;
            }
        }
    }
    cout<<sum;
}
Re: WA on Test#8!
Posted by cena 30 Nov 2012 14:25
dude,that's my problem too,plz tell me if you got the solution.
thanx==>cena