Page 1 of 1

Posted: Sun Jul 13, 2003 4:57 pm
by Julien Cornebise
Hi (re) :)

the easiest way to read the input is to use the fact than
[c]scanf("%d", &n);[/c]
will read an integer, skipping whatever white space of newline present before, so you don't have to care about it.
So :
[c]
int entry[2][MAXN];
int nscenar;
int ndigits;
int i;
/* For each scenario */
for (scanf("%d", &nscenar); nscenar > 0; nscenar--) {
scanf("%d", &ndigits);
/* For each digit */
for (i=0; i<ncase; i++)
scanf("%d %d", &entry[0], &entry[1]);
/* And then, solve ;) */
/* ... */
}

[/c]
should do it.

Hope that helps :)

Posted: Fri Jun 03, 2005 11:42 am
by jakabjr
more generally, if u need to skip any number of blank spaces (which are specified by isspace() for instance), u can also use scanf(" ");
the "%s", "%d", "%f" type conversion specifiers do this implicitly.