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 1545. Hieroglyphs

Strange(WA1)
Posted by Alexander Sokolov [MAI-7] 18 Jun 2007 21:48
Why this gets WA1?

//---------------------------------------------------------------------------
#include <iostream.h>
#include <memory.h>
int main()
{
        bool mas[30][30];
        for (int i=0; i<30; ++i)
        for (int j=0; j<30; ++j)
        {
                mas[i][j]=false;
        }
        int n;
        char ch,ch1,ch2;
        cin>>n;
        for (int i=0; i<n; ++i)
        {
                cin>>ch1>>ch2;
                mas[ch1-'a'][ch2-'a']=true;
        }
        cin>>ch;
        for (int i=0; i<30; ++i)
        {
                if (mas[ch-'a'][i])
                {
                        cout<<ch<<(char)(i+'a')<<endl;
                }
        }
        cin>>ch;
        return 0;
}
//---------------------------------------------------------------------------
Re: Strange(WA1)
Posted by Alias (Alexander Prudaev) 19 Jun 2007 02:26
//what about RC/LF ?
//for example
//there is a text text file which contents some symbols
ab
ac
ba

//but on your hard disk drive it is look as ( in hexadimal )
"61620D0A61630D0A62661"
//0D0A it is an linefeed in windows
//and when you are read as cin >> ch1;
//you read all characters from input file include these symbols;
//instead of cin >> x >> y ( when x and y have type "char")
//you must to use

char s[10];
cin.getline(s,10);
x = s[0]; y = s[1];

//or
char s[10];
scanf("%s", s);
x = s[0]; y = s[1];
or
scanf("%c%c\n",&x,&y);
Re: Strange(WA1)
Posted by Alexander Sokolov [MAI-7] 4 Jul 2007 00:30
It does not work(((

Can u mail me your solution to diablo_@list.ru?
Re: Strange(WA1)
Posted by zsyzhbc_china 18 Mar 2009 10:42
谁有测试数据(chinese)