标签:
简单的dfs。不必考虑时间。瞬秒。
var s,s1,s2:string;
k,n,m:longint;
procedure go(k:longint);
begin
if k=m then begin
write(‘YES‘);
halt;
end;
if k>m then exit;
go(2*k+1);
go(3*k+1);
end;
begin
readln(s);
k:=pos(‘,‘,s);
s1:=copy(s,1,k-1);
delete(s,1,k);
s2:=s;
val(s1,n);
val(s2,m);
go(n);
write(‘NO‘);
end.
标签:
原文地址:http://www.cnblogs.com/love-saber/p/5931565.html