|
|
вернуться в форумMaybe the format of input is not: number_number. ("_"represent a space) So please read it one character by another. 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; Maybe you are right ! I change my reading procedure (not like you) and I got AC 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. 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. |
|
|