thinking

来源:互联网 发布:收购淘宝店铺骗局 编辑:程序博客网 时间:2024/06/05 03:25

题没写几道

但是学了很多思想

想一些图形变换,可以直接再输入时变,直接输出结果就是答案

数组保存不了英文单词所以直接可以用变量‘x’进行判定

用“if”语句带,然后再用数组存数据

排序可以用sort  

不方便。。。。。。不是很懂。。。。。。。

还有格什么鬼的嗯

话说有道什么笨小猴的题

洛谷上很长。。var s:string;//待读入字符串 i,m,l,p:longint; Rec:Rev; Ch:array[1..255]of longint; functionprime(n:longint):boolean;//求质数var i,j:longint; beginif n=0thenexit(false);//注意0不是质数,少写这步90分if n=1thenexit(false);if n=2thenexit(true); prime:=true; i:=2;//从2开始寻找质数while (i<=trunc(sqrt(n)))and(nmod i<>0)do//优化算法inc(i);if i<=trunc(sqrt(n)) then prime:=false; end;procedureqsort(var a:Rev;l,r:longint);//快排var i,j,m,k:longint; begin i:=l; j:=r; m:=a[(l+r) shr1];//不要写成 m:=a[(l+r) shl 1];,n shr 1=n div 2;n shl 1=n*2repeatwhile a[i]<m do inc(i); while a[j]>m do dec(j); if i<=j thenbegin k:=a[i]; a[i]:=a[j]; a[j]:=k; inc(i); dec(j); end;until i>j; if l<j then qsort(a,l,j); if i<r then qsort(a,i,r); end;begin readln(s); for i:=1to length(s) do inc(Rec[ord(s[i])]); //将字符个数累加 qsort(Rec,0,255);//也可以用打擂台,用快排显得多此一举for i:=0to255doif rec[i]<>0thenbegin inc(m); Ch[m]:=Rec[i];end;//将Rec[i]中的0丢弃不用(不然最小值始终是0),将非零值拷贝到Ch[m]中 l:=Ch[m]-Ch[1];//取max和min相减if (prime(l)) thenbegin writeln('Lucky Word'); writeln(l); endelsebegin writeln('No Answer'); writeln(0);//不要输出l,即使l不是质数end;end.




。。。。

难懂,每天脑细胞死好多。

要死还要开夜车

困。。-