除了高精度,还有哪里错?大牛帮忙!

program EX1;

var a,b,i,j,k,l,n,m,x,y,p,q,t:longint;

s:string;

bb:boolean;

begin

readln(s);

for i:=1 to length(s) do if s[i]'/' then a:=a*10+ord(s[i])-ord('0')

else break;

for j:=i+1 to length(s) do b:=b*10+ord(s[j])-ord('0');

readln(n);

for i:=1 to n do

begin

x:=0;y:=0;

readln(s);

l:=length(s);

if s'swap' then begin

if s[10]='z' then x:=a

else if s[10]='m' then x:=b

else for j:=7 to l do if not(s[j] in ['0'..'9']) then break

else x:=x*10+ord(s[j])-ord('0');

for j:=7 to l do if not((s[j] in['0'..'9'])or(s[j] in['A'..'Z'])or(s[j] in['a'..'z'])) then break;

m:=j;

if s[m+4]='z' then y:=a

else if s[m+4]='m' then y:=b

else for j:=m+1 to l do

y:=y*10+ord(s[j])-ord('0');

if s[4]='z' then bb:=true else bb:=false;

case s[m] of '+':p:=x+y;

'-':p:=x-y;

'*':p:=x*y;

'/':p:=trunc(x/y);

'^':begin p:=x;for q:=1 to y-1 do p:=p*x;end;

end;

if p

0 条评论

目前还没有评论...

信息

ID
1630
难度
6
分类
模拟 | 高精度 点击显示
标签
(无)
递交数
152
已通过
38
通过率
25%
被复制
2
上传者