USACO CRYPT1.doc

上传人:11****ws 文档编号:3180605 上传时间:2019-05-24 格式:DOC 页数:3 大小:33KB
下载 相关 举报
USACO CRYPT1.doc_第1页
第1页 / 共3页
USACO CRYPT1.doc_第2页
第2页 / 共3页
USACO CRYPT1.doc_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

1、Prime CryptarithmThe following cryptarithm is a multiplication problem that can be solved by substituting digits from a specified set of N digits into the positions marked with *. If the set of prime digits 2,3,5,7 is selected, the cryptarithm is called a PRIME CRYPTARITHM. * * *x * *-* * * 0 do beg

2、inif not akk mod 10 then exit;kk:=kk div 10;end;check:=true;end;procedure sub(k1:longint);vari1,m1,m2,m3:longint;beginif k1=6 then beginm1:=a1 mod 10;m2:=a1 mod 100;m3:=a1 div 100;if (m2*m3=1000) and (m2*m3=100)and check(m2*m3) and check(m1*m3) then inc(ans);exit;end;if k1=5 then beginm1:=a1 mod 10;

3、m2:=a1 div 10;if (m1*m2=1000) or (m1*m2100) or not check(m1*m2) then exit;end;for i1:=1 to 9 doif ai1 then begina1:=a1*10+i1;sub(k1+1);a1:=a1 div 10;end;end;beginassign(input,crypt1.in);assign(output,crypt1.out);reset(input);rewrite(output);ans:=0;fillchar(a,sizeof(a),false);readln(n);for i:=1 to n do beginread(m);am:=true;end;a1:=0;sub(1);writeln(ans);close(input);close(output);end.

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育教学资料库 > 精品笔记

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。