1131 - Divisors

Discussion around the problems of the COJ.
Forum rules
Remember that posting AC code is not allowed here. If you are going to ask a question or to post a solution, describe your algorithm instead. Posting AC code will be penalized.
Post Reply
User avatar
dovier
Posts: 1143
Joined: 9 years ago
Location: Havana, Cuba
Gender: Male
Cuba

1131 - Divisors

Post by dovier » 9 years ago




laygr
Posts: 4
Joined: 7 years ago
Gender: None specified

Re: 1131 - Divisors

Post by laygr » 7 years ago

How are we supposed to know when does the program terminate!?!?!?!? :( :( :(

george
Posts: 43
Joined: 9 years ago
Gender: None specified

Re: 1131 - Divisors

Post by george » 7 years ago

laygr wrote:How are we supposed to know when does the program terminate!?!?!?!? :( :( :(
In these cases most of the time you should read until the end of file(EOF)

Java example:

Code: Select all

BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

String line = "";
while((line = reader.readLine()) != null) {
// do something
}
C++ Example:

Code: Select all

int a,b;

while(scanf("%d%d",&a,&b)!= EOF)
{
//do something
}
Hope this help

Post Reply

Return to “Problem set”