1 solutions
-
0
Pascal :
program p2; type wolf=record x:string; y:char; end; var str,strz,strx,zong,jiluzheng:string; p,k,jilud,changdu,pp,i,chang:integer; a:array[1..5] of wolf; procedure duzheng(str:string); var chang,k,i,p,j:integer; puanduan:boolean; jilu:string; jilu1:array[1..4] of char; begin jilu1[1]:=' '; jilu1[2]:='S'; jilu1[3]:='B'; jilu1[4]:='Q'; chang:=length(str); k:=chang div 4; if (chang mod 4)<>0 then k:=k+1; for i:=1 to k do begin p:=length(str)-4; if p>=0 then begin a[i].x:=copy(str,length(str)-3,4); delete(str,length(str)-3,4); end else a[i].x:=str; end; for i:=1 to k do begin chang:=length(a[i].x); p:=1; while a[i].x[p]='0' do p:=p+1; if p=1 then jilu:='' else jilu:='0'; puanduan:=true; for j:=p to chang do begin if (puanduan=true)or(a[i].x[j]<>'0') then jilu:=jilu+a[i].x[j]; if a[i].x[j]='0' then puanduan:=false else puanduan:=true; if (a[i].x[j]<>'0')and(jilu1[chang-j+1]<>' ') then jilu:=jilu+jilu1[chang-j+1]; end; chang:=length(jilu); k:=chang; while jilu[k]='0' do k:=k-1; delete(jilu,k+1,chang-k); if i<>1 then jilu:=jilu+a[i].y; insert(jilu,jiluzheng,1); end; end; begin readln(str); if str[1]='-' then p:=-1 else p:=0; if p=-1 then delete(str,1,1); k:=1; while str[k]='0' do k:=k+1; delete(str,1,k-1); jilud:=pos('.',str); changdu:=length(str); pp:=0; if jilud<>0 then begin strz:=copy(str,1,jilud-1); strx:=copy(str,jilud+1,changdu-jilud); pp:=-1; end else strz:=str; for i:=1 to 5 do a[i].y:=' '; a[1].y:=' '; a[2].y:='W'; a[3].y:='Y'; duzheng(strz); chang:=length(strx); k:=chang; while strx[k]='0' do dec(k); delete(strx,k+1,chang-k); if jiluzheng='' then jiluzheng:='0'; if pp=-1 then zong:=jiluzheng+'D'+strx else zong:=jiluzheng; if p=-1 then insert('F',zong,1); writeln(zong); end.
- 1
Information
- ID
- 19249
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By