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 1242. Werewolf

for anyone who wants to solve this problem:
Posted by Koala 10 Sep 2003 07:51
Maybe the format of input is not: number_number. ("_"represent a
space) So please read it one character by another.
And i'll share you the procedure of reading datas.
Posted by Koala 10 Sep 2003 07:53
  readln(n);
  fillchar(a,sizeof(a),0);
  fillchar(b,sizeof(b),0);
  while true do
  begin
    read(ch); while ch=' ' do read(ch);
    if ch='B' then
    begin
      readln;
      break;
    end;
    x:=0;
    while ch<>' ' do
    begin
      x:=x*10+ord(ch)-ord('0');
      read(ch);
    end;
    readln(y);
    insert(a[x],y); insert(b[y],x);
  end;
Re: And i'll share you the procedure of reading datas.
Posted by GodZilla 15 Sep 2003 20:07
Maybe you are right !
I change my reading procedure (not like you) and I
got AC
Thank you!I got AC.
Posted by Y.Y.M. 14 Jun 2004 19:40
At first,I used String to read data.
But I WA on text#1.
Finally,I realized that the input formal is like this:
number_number_.There may be some '_' after the second number.
I improve my program and got AC.
That's right. The second line in sample input #2 has a space at the end of line. But(+)
Posted by Maigo Akisame (maigoakisame@yahoo.com.cn) 14 Oct 2004 04:48
But you don't need to read character by character. You read a string, then delete all the spaces at its end, and you'll get AC.