Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

fortran

Posted by azma at 2008-12-22 16:10:53 on Problem 2840
	PROGRAM pku2840

	INTEGER, PARAMETER :: strlen = 10
  	INTEGER :: status, i = 1,count,h,m,d
  	CHARACTER(len=strlen) :: str = ""
	integer , DIMENSION(0:25) :: tic 
	character(1) :: n  	           






	tic(0) = 12
	tic(1) = 13
	tic(2) = 14
	tic(3) = 15
	tic(4) = 16
	tic(5) = 17
	tic(6) = 18
	tic(7) = 19
	tic(8) = 20
	tic(9) = 21
	tic(10) = 22
	tic(11) = 23
	tic(12) = 24
	tic(13) = 1
	tic(14) = 2
	tic(15) = 3
	tic(16) = 4
	tic(17) = 5
	tic(18) = 6
	tic(19) = 7
	tic(20) = 8
	tic(21) = 9
	tic(22) = 10
	tic(23) = 11
	tic(24) = 12
	read *, count
	outer: do
		if (count <= 0) exit
		count = count -1
		read *,str
		n = str(1:1)

			if (n == '0') d = 0
			if (n == '1') d = 1 
			if (n == '2') d = 2 
			if (n == '3') d = 3 
			if (n == '4') d = 4 
			if (n == '5') d = 5 
			if (n == '6') d = 6 
			if (n == '7') d = 7 
			if (n == '8') d = 8 
			if (n == '9') d = 9

		h = d		
		n = str(2:2)
		d = -1

			if (n == '0') d = 0
			if (n == '1') d = 1 
			if (n == '2') d = 2 
			if (n == '3') d = 3 
			if (n == '4') d = 4 
			if (n == '5') d = 5 
			if (n == '6') d = 6 
			if (n == '7') d = 7 
			if (n == '8') d = 8 
			if (n == '9') d = 9
			if (n == ':') d = 10
		
		if (d .NE. -1 .and. d .NE. 10) then
			h = h * 10
			h = h + d
			m = 0;
			n = str(4:4)
			d = -1

			if (n == '0') d = 0
			if (n == '1') d = 1 
			if (n == '2') d = 2 
			if (n == '3') d = 3 
			if (n == '4') d = 4 
			if (n == '5') d = 5 
			if (n == '6') d = 6 
			if (n == '7') d = 7 
			if (n == '8') d = 8 
			if (n == '9') d = 9

			if ( d .NE. -1) then
				m = m + d
				n = str(5:5)
				d = -1

				if (n == '0') d = 0
				if (n == '1') d = 1 
				if (n == '2') d = 2 
				if (n == '3') d = 3 
				if (n == '4') d = 4 
				if (n == '5') d = 5 
				if (n == '6') d = 6 
				if (n == '7') d = 7 
				if (n == '8') d = 8 
				if (n == '9') d = 9

				if ( d .NE. -1) then
					m = m * 10
					m = m + d
				end if
			end if

		end if
		if (d == 10) then


			m = 0;
			n = str(3:3)
			d = -1

			if (n == '0') d = 0
			if (n == '1') d = 1 
			if (n == '2') d = 2 
			if (n == '3') d = 3 
			if (n == '4') d = 4 
			if (n == '5') d = 5 
			if (n == '6') d = 6 
			if (n == '7') d = 7 
			if (n == '8') d = 8 
			if (n == '9') d = 9

			if ( d .NE. -1) then
				m = m + d
				n = str(4:4)
				d = -1

				if (n == '0') d = 0
				if (n == '1') d = 1 
				if (n == '2') d = 2 
				if (n == '3') d = 3 
				if (n == '4') d = 4 
				if (n == '5') d = 5 
				if (n == '6') d = 6 
				if (n == '7') d = 7 
				if (n == '8') d = 8 
				if (n == '9') d = 9

				if ( d .NE. -1) then
					m = m * 10
					m = m + d
				end if
			end if

		end if
		if ( m .NE. 0) then
			WRITE(*, "(I0)") 0
		else
			WRITE(*, "(I0)") tic(h)
		end if


	end do outer
	END

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator