Search found 24 matches

by Astrakan
Fri Feb 28, 2003 12:08 am
Forum: Volume 100 (10000-10099)
Topic: 10050 - Hartals
Replies: 59
Views: 27757

This problem is quite easy. The cases you might want to check are boundary cases, like N=3650, P=1, P=100 etc., and those when a hartal occurs on the last day of the simulation or the day after the last. This input 6 1 1 1 3650 1 1 20 1 20 21 1 21 21 1 22 22 1 22 should give this output: 1 2608 0 0 ...
by Astrakan
Wed Feb 26, 2003 11:57 pm
Forum: Volume 100 (10000-10099)
Topic: 10050 - Hartals
Replies: 59
Views: 27757

Try this input data (first line is T):

Code: Select all

1
20
1
20
Output should be 0 (why?).

Hope this helps.
by Astrakan
Tue Feb 25, 2003 11:50 pm
Forum: Volume 100 (10000-10099)
Topic: 10050 - Hartals
Replies: 59
Views: 27757

Yahoo, this part is dubious: [c]while(1) { r=scanf("%d" ,&n); if(r==EOF) break; [/c] You should not try to read until EOF. According to the specification, "The first line of the input consists of a single integer T giving the number of test cases to follow. " Read the number ...
by Astrakan
Wed Jan 22, 2003 11:02 pm
Forum: Volume 100 (10000-10099)
Topic: 10035 - Primary Arithmetic
Replies: 328
Views: 94223

Try a case which gives one carry operation, for example

Code: Select all

15 15
by Astrakan
Tue Jan 21, 2003 5:57 pm
Forum: Volume 100 (10000-10099)
Topic: 10025 - The ? 1 ? 2 ? ... ? n = k problem
Replies: 42
Views: 16520

Try this input, and you'll see:

Code: Select all

3

1

1

1
Also, there should be no blank line before the first output case, and after the last output case. There should only be blank lines between the output cases.
by Astrakan
Tue Jan 21, 2003 11:29 am
Forum: Volume 100 (10000-10099)
Topic: 10003 - Cutting Sticks
Replies: 59
Views: 34881

Try this case:

Code: Select all

1000
49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
Output should be 1279.
by Astrakan
Tue Jan 21, 2003 11:19 am
Forum: Volume 100 (10000-10099)
Topic: 10025 - The ? 1 ? 2 ? ... ? n = k problem
Replies: 42
Views: 16520

You should check the existing thread about this problem ( http://acm.uva.es/board/viewtopic.php?t=1805 ). It's a multiple input problem (blue check mark). You should read http://acm.uva.es/problemset/minput.html to find out what the input and output should look like. The first line of input contains...
by Astrakan
Tue Jan 21, 2003 11:11 am
Forum: Volume 100 (10000-10099)
Topic: 10035 - Primary Arithmetic
Replies: 328
Views: 94223

TWEmp, try this case, which your program doesn't handle correctly:

Code: Select all

999999999 999999999
The sum of two 9-digit numbers fits in a long int, but the product of a 9-digit number and 10 does not always fit.
by Astrakan
Thu Jan 16, 2003 11:48 am
Forum: Volume 100 (10000-10099)
Topic: 10025 - The ? 1 ? 2 ? ... ? n = k problem
Replies: 42
Views: 16520

It's a multiple input problem (blue check mark). You should read http://acm.uva.es/problemset/minput.html to find out what the input and output should look like. The first line of input contains the number of cases, and there should be a blank line between each output case.
by Astrakan
Sat Jan 11, 2003 1:20 pm
Forum: Volume 100 (10000-10099)
Topic: 10009 - All Roads Lead Where?
Replies: 60
Views: 22431

You could try to make a solution that doesn't care about missing blank lines between cases. My solution ignores blank lines, so I don't know if the input has blank lines or not. You could also try to make the buffer bigger, if there are really long lines, since the maximum length of a city name is n...
by Astrakan
Fri Jan 10, 2003 8:04 pm
Forum: Volume 100 (10000-10099)
Topic: 10050 - Hartals
Replies: 59
Views: 27757

Try this input:

Code: Select all

1
3650
1
1
Output should be 2608, not 2607.
by Astrakan
Thu Jan 02, 2003 8:19 pm
Forum: Volume 100 (10000-10099)
Topic: 10008 - What's Cryptanalysis?
Replies: 55
Views: 24763

Using fflush is wrong. fflush is only used for ensuring that all data written to a stream is really written to disk (or at least to kernel buffers...). You cannot use fflush to consume the newline character after the number on the first line. Instead, you could simply do [c]gets(line);[/c] right aft...
by Astrakan
Wed Jan 01, 2003 1:18 pm
Forum: Volume 100 (10000-10099)
Topic: 10035 - Primary Arithmetic
Replies: 328
Views: 94223

Using long int works fine, since the sum of two 9-digit numbers is less than 2000000000 which fits in a long int, and in this case the sum is not even calculated.

There is another error error in the program.

Try the case

Code: Select all

9899 1
The answer should be 2, not 3.
by Astrakan
Wed Dec 25, 2002 3:06 pm
Forum: Volume 100 (10000-10099)
Topic: 10025 - The ? 1 ? 2 ? ... ? n = k problem
Replies: 42
Views: 16520

Your program doesn't produce the correct output for k=3. Output should be 2 (1+2 = 3) but your program answered 5 when I tried it.
by Astrakan
Wed Dec 25, 2002 1:26 pm
Forum: Volume 100 (10000-10099)
Topic: 10024 - Curling up the cube
Replies: 13
Views: 5283

The output for your test cases is correct. However, did you notice that this is a multiple input-problem (blue check mark)? Your program should accept input like this: 2 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 ...

Go to advanced search