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

PASCAL代码,水题

Posted by demaxiya at 2012-08-28 10:42:51 on Problem 2840
var
i,j,k,n,p:integer;
s:string;
begin
readln(k);
for i:=1 to k do
begin
readln(s);
n:=pos(':',s);
if n=2 then p:=ord(s[i])-48
       else if s[1]='0' then p:=ord(s[2])-48
                      else p:=(ord(s[1])-48)*10+ord(s[2])-48;
if (s[n+1]<>'0') or (s[n+2]<>'0') then writeln(0)
                            else if (p>=0) and (p<=12) then writeln(p+12)
                                                       else writeln(p-12);
end;
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