Site Navigation

Home
 
My Programs
 

     C# Classes

     VB 6.0 Programs

     C Programs

     C Games

Articles

My Blog

Page for Classmates

Programs by Others

Programming Problems

     Software Competitions


Programming Forum

Sign my Guestbook

View my Guestbook

Email me

 

International Software Competition: SEARCC 96

Ambassador Hotel, Bangkok, Thailand.

July 6, 1996

 

Problem 1

Prime Problem:

How many prime numbers between a given non-negative integer range, n and m (including the values of n and m), in which the summation of all digits in each prime must be equal to p? Assume that 1 ≤ n ≤ 1000 , 1 ≤ m ≤ 2000, 0 ≤ p ≤ 30, and n ≤ m.

 

Input

n

m

p

 

Output

Number of prime numbers with the above condition.

 

Example:

Input

DATA 10

DATA 35

DATA 4

 

Output to the screen

2

 

Problem 2

Maze Problem:

Given an arbitrary map of a rectangular maze where the locations marked by x form the maze wall, and the locations marked by - represent the space. Write a program to find a shortest route between the two locations that are marked by *. Find also the number of steps of walk in the route. Each step of walk can be in rectangular direction only i.e. left, right, up or down. Use @to show the route. The data file wilt be a text file which contains only characters x, - and * (except the first line which defines the size of the maze) which describe the maze as defined above.

 

Example:

 

The input must be read from the file named test2.in, and the result must be on the screen

 

Input from the file test2.in":

6 9                  <maze size (row col) the maximum size is 20 x 60.>

------*--

-xxxxx---            <No space between each symbol

-x---x---             and there are exactly two * in the input file.>

-x-*-x---

-----xx--

---------

 

Output to the screen:

------@--

-xxxxx@--

-x---x@--

-x-@-x@@-

---@-xx@-

---@@@@@-

 

12 Step(s)

 

Note

  • If there are more than one solution, show only one solution.
  • If there is no route, the output must display only No route on the screen.

 

Problem 3

Internet Service Provider (ISP) Problem:

A manager of an ISP company wants to analyze system usages from the log file to find the utilization of the system. He wants to know:

  1. How long did each user use the system?

  2. What is the time interval which has the maximum number of users using the system simultaneously?

When a user wants to use the system he (or she) must log in into the system and after finishing his work he must also log out off the system. For each logging in or logging out, the system will keep track of the user activity by storing the time into the log file.

The information kept in the log file consists of the following 4 fields:

  • User ID        (non-negative integer, range 1-100)

  • Log record type (1-log in, or 2-log out)

  • Login or logout time (hour, min)

 

The log file is presented in the DATA statement with the following format (all values are nonnegative integers):

Input

DATA <number of records>

DATA <user id>, <record type>, <hour>, <min>

 

Example

 

Input from DATA Statement:

DATA 6

DATA 1,1,10,30

DATA 2,1,40,40

DATA 1,2,10,45

DATA 3,1,11,20

DATA 3,2,11,25

DATA 2,2,9,10

 

Output to the screen:

UserID Hour  Min

1      0     15

2      22    30

3      0     5

 

The maximum number of users using the system simultaneously is: 2

 

The, maximum utilization interval is:

10:40-10:45

11:20-11:25

 

Note:

  1. The maximum number of records is 100.

  2. The maximum number of users is 100.

  3. When the log out time is less than the log in time, you must assume that the user logged in over the night.

  4. A user can log in more than one time.

  5. Assume that there is no case that a user logged in more than once before he logged out.

  6. The time used is the 24-hour system (00:00 - 23:59).

  7. Each login must always has its pair of logout.

  8. You can assume that a user will not login with the duration more than 24 hours.

  9. You must include the case that the user logged in and logged out at the same time, which means the user log in for 24 hours duration.

  10. The log file is in chronological sequence.

 

Problem 4

Line Intersections Problem:

Write a program to find the number of intersecting pairs among a set of N lines.

 

The input defines a set of lines by a nonnegative integer N, representing the number of lines in the set, followed by N input lines describing the lines in the set. Each line description contains four nonnegative integer x1, y1, x2 and y2, that is, a line is represented by a pair of endpoints (x1, y1) and (x2, y2).

 

Assuming that 0 ≤ x ≤ 20, 0 ≤ y ≤ 20, 0 ≤ N ≤ 20 and the maximum number of intersection points is 100.

 

Assume also that if more than two lines intersect at the exact same point, this intersecting point will be counted as one and there is no two or more lines that are overlapped.

 

Input:

DATA 3

DATA 2, 2, 3, 8

DATA 1, 3, 8, 9

DATA 6, 9, 7, 4

 

Output to the screen:  

2