斯诺登的密码
来源:互联网 发布:大淘客数据接口怎么用 编辑:程序博客网 时间:2024/05/17 17:46
题意
找出句子中所有用英文表示的数字(≤20),将这些数字平方后%100,如00,05,11,19,86,99。把这些两位数按数位排成一行,组成一个新数,如果开头为0,就去0。找出所有排列方法中最小的一个数,即为密码。
分析
先计算出每一个数字的平方,不过在放进数组里时,只放两位。
如1的平方是1,放进数组里时则变成01。
如10的平方是100,放进数组里时则变成00。
最后排序再输出。
var
i,j:longint;
a:array[0..20]of string;
s,zfc,sz:string;
dz:int64;
begin
read(s);
dz:=0;
repeat
sz:=copy(s,1,pos(' ',s)-1);
if (sz='one')or(sz='One')or(sz='a')or(sz='another')or(sz='first') then
begin
inc(dz);
a[dz]:='01';
end else
if (sz='two')or(sz='Two')or(sz='both')or(sz='second') then
begin
inc(dz);
a[dz]:='04';
end else
if (sz='three')or(sz='Three')or(sz='third') then
begin
inc(dz);
a[dz]:='09';
end else
if (sz='four')or(sz='Four') then
begin
inc(dz);
a[dz]:='16';
end else
if (sz='five')or(sz='Five') then
begin
inc(dz);
a[dz]:='25';
end else
if (sz='six')or(sz='Six') then
begin
inc(dz);
a[dz]:='36';
end else
if (sz='seven')or(sz='Seven') then
begin
inc(dz);
a[dz]:='49';
end else
if (sz='eight')or(sz='Eight') then
begin
inc(dz);
a[dz]:='64';
end else
if (sz='nine')or(sz='Nine') then
begin
inc(dz);
a[dz]:='81';
end else
if (sz='ten')or(sz='Ten') then
begin
inc(dz);
a[dz]:='00';
end else
if (sz='eleven')or(sz='Eleven') then
begin
inc(dz);
a[dz]:='21';
end else
if (sz='twelve')or(sz='Twelve') then
begin
inc(dz);
a[dz]:='44';
end else
if (sz='thirteen')or(sz='Thirteen') then
begin
inc(dz);
a[dz]:='69';
end else
if (sz='fourteen')or(sz='Fourteen') then
begin
inc(dz);
a[dz]:='96';
end else
if (sz='fifteen')or(sz='Fifteen') then
begin
inc(dz);
a[dz]:='25';
end else
if (sz='sixteen')or(sz='Sixteen') then
begin
inc(dz);
a[dz]:='56';
end else
if (sz='seventeen')or(sz='Seventeen') then
begin
inc(dz);
a[dz]:='89';
end else
if (sz='eighteen')or(sz='Eighteen') then
begin
inc(dz);
a[dz]:='24';
end else
if (sz='nineteen')or(sz='Nineteen') then
begin
inc(dz);
a[dz]:='61';
end else
if (sz='twenty')or(sz='Twenty') then
begin
inc(dz);
a[dz]:='00';
end;
delete(s,1,pos(' ',s));
until s[1]='.';
for i:=1 to dz-1 do
begin
for j:=i+1 to dz do
if a[i]>=a[j] then
begin
a[0]:=a[i];a[i]:=a[j];a[j]:=a[0];
end;
end;
zfc:='';
for i:=1 to dz do
zfc:=zfc+a[i];
val(zfc,dz);
write(dz);
end.
- P1603 斯诺登的密码
- 斯诺登的密码
- P1603 斯诺登的密码
- 斯诺登的密码
- 斯诺登的密码
- [LUOGU1603] 斯诺登的密码
- 洛谷1603 斯诺登的密码
- [洛谷1603]斯诺登的密码
- 洛谷 P1603 斯诺登的密码
- 洛谷 P1603 斯诺登的密码
- 洛谷 P1603 斯诺登的密码
- 洛谷 P1603 斯诺登的密码
- #洛谷 P1603 斯诺登的密码
- 洛谷 1603 斯诺登的密码
- 【密码】oracle修改密码,11g的加密密码不见了
- 检查密码和确认密码的JavaScript
- [WPF]实现密码框的密码绑定
- 忘记sqlserver2000的密码 修改密码
- POJ 3252Round Numbers(数位DP)
- c++ Vector 使用心得
- HDU - 1086.You can Solve a Geometry Problem too
- Validation校验(二)
- Universal-ImageLoader源码流程浅析之(一)--参数配置及主要参数说明
- 斯诺登的密码
- PHP数据库 mysql(三)
- codevs天梯 cantor表 找规律
- 问题六十四:怎么用C++实现二叉查找树(binary search tree)及其相关操作
- ubuntu14.04 nginx-rtmp-module 配置
- (转)Android中获取应用程序(包)的信息-----PackageManager的使用(一)
- Mysql多列索引——最左精确匹配
- python的reduce()函数
- C# Invoke and BeginInvoke