UVA input format is very frustrating to deal with, or that what I see. For example this UVA 825 problem Anyone can help how to deal with this type of input format and other formats like not giving the number of testcases, the input ends by a newline and other things like those ? :)
This is really annoying.
Maybe try to do
while(testCases--){ int W, N; cin >> W >> N; while(W--){//and so on} }
And when there are no testcases ?
Thanks for that, and when the input of one line ends by the end of that line please ?
getline(cin,s) then process the string and take your input from it often when i solve problem on uva and the can't deal with input i search of the problem solution on git hub and see how the accepted solution process the input :)
what about while(cin>>x)
In the problem above, the input of one line ends by the end of the line.
may be getline can use for that situation