|
|
back to boardI think it's easy problem we can use something like binary search for find answer , but how can we read input data : if it will be input.txt we can do like that while not eof do but it's now console You don't need to use binary search All numbers can be stored in extended type If so then it's very simple, but i'm getting WA :( Isn't simple recurse with sqrt() function not right? why? I obviously can't read the input correctly. I do it this way: while not eof do begin read(a); ... end; ... Is that right? Edited by author 01.01.2007 04:03 Edited by author 01.01.2007 04:03 Yes of course sqrt(), but trouble is to get numbers from flow You should read text char by char until eof Numbers can be stored in array without recursion Edited by author 01.01.2007 04:33 Yes of course sqrt(), but trouble is to get numbers from flow You should read text char by char until eof Numbers can be stored in array without recursion Edited by author 01.01.2007 04:33 I'm stupid :) It can be solved simple with seekeof while not seekeof do ... read(number); ... Edited by author 01.01.2007 15:22How I can do it on C++ ?? Edited by author 01.01.2007 21:02 thanks, seekeof works fine :) Yes,I can't do it too! It annoyed me for a long time: [code deleted] Where's my problem! Edited by author 03.02.2007 13:22 Edited by moderator 13.02.2007 20:57 1-st "int" is not enough to input 2-nd try to use printf instead setprecision. Here is your AC program: But better is to use only array, not stack!!! [code deleted] Edited by moderator 13.02.2007 20:57 And how can I find the end of input using Java? FAQ says nothing about it... Does it work? while (in.nextToken() != StreamTokenizer.TT_EOF) { // ... } You can use "seekeof" function instead of "eof". It presented even in BP7.0, so you can easily find description. |
|
|