题解

103 条题解

  • 4
    @ 2009-10-09 21:27:09

    情书吸引我使我忘了做题!

  • 2
    @ 2009-08-20 21:01:41

    总算AC了...两年的怨念啊...

    第二个点WA的话,输出用write(chr((ord(a[i])-t-71) mod 26+97))的模式...

    感谢candyhby

  • 1
    @ 2021-03-19 13:11:52
    #include <cmath>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <algorithm>
    #include <vector>
    #include <deque>
    using namespace std;
    
    namespace dts
    {
        const char key='e';
        
        int sz,t;
        char se[1<<24],oa[1<<24];
        
        void getatc()
        {
            sz=0;
            memset(se,0,sizeof(se));
            for (char c;~scanf("%c",&c);)
                se[sz++]=c;
        }
        void calc()
        {
            int cntse[26];
            memset(cntse,0,sizeof(cntse));
            for (int i=0;i<sz;i++)
                if ('a'<=se[i]&&se[i]<='z')
                    cntse[se[i]-'a']++;
                else if ('A'<=se[i]&&se[i]<='Z')
                    cntse[se[i]-'A']++;
            int maxx=0;
            for (int i=1;i<26;i++)
                if (cntse[i]>cntse[maxx])
                    maxx=i;
            t=key-(maxx+'a');
            t=((t%26)+26)%26;
        }
        char turn(char c,int num)
        {
            if ('a'<=c&&c<='z')
            {
                int ans=c+num;
                if (ans>'z')
                    ans-=26;
                return char(ans);
            }
            else if ('A'<=c&&c<='Z')
            {
                int ans=c+num;
                if (ans>'Z')
                    ans-=26;
                return char(ans);
            }
            else
                return c;
        }
        void sol()
        {
            memset(oa,0,sizeof(oa));
            for (int i=0;i<sz;i++)
                oa[i]=turn(se[i],t);
            for (int i=0;i<sz;i++)
                printf("%c",oa[i]);
        }
        void main()
        {
            getatc();
            calc();
            sol();
        }
    };
    
    int main()
    {
        dts::main();
    }
    
  • 1
    @ 2009-08-12 14:49:41

    样例输出的中文版:

    我会向你展示

    是的,我仍然感到惊讶,我有你。它仍然很难理解你如何选择了我。如何在一个简短的谈话你知道我是为了你。但现在我知道真相的信念。我从来没有与别人谁适合我这么完美。你勾引我,你性感的身体和强大的精神,您使我的心与您的投标。我知道你,我不能和你也许不完全甚至更长的时间。但我仍然很高兴。你的一部分已成为我的一部分,这是不够的。

    你会笑,当我说这一点,但我的梦想你每晚。可能是因为我不能看到你往往不够的。但是,当我醒来我知道你是最遥远的事情由一个梦想。有时我想,您是建立由固体岩石:移动雕像和一个坚不可摧的人。你绝对控制自己,然后再次远远超过自己。你的信任,是消费和您的观点是十分巨大的。您还没有发生在你生活的嫉妒或投诉。我的朋友们这么小的比较,总是与他们的问题蔓延到其他人。

    我想让你知道有多少你已经打开了我的眼睛,让我真正看到自己。到现在为止,我的生活一直是未定回和规定,现在我知道,我已经浪费了太多时间。但现在我的方向似乎很清楚,我有信心,我的未来。过去似乎没有问题了。您使我看到的可能性,我永远不会想到面前。

    是的,我想请你。但是,通过取悦你,我会成为一个更好的和更强有力的人。没有什么我想多把自己通过你。我向你挑战,超越自己,离开我弱的自我后面。我会向你展示如何美丽我可以,我将告诉您如何辉煌我可以成为。这样一来,我知道我将永远爱你。

    永远你,

    Matrix67

  • 0
    @ 2016-07-31 08:55:09

    发题解喽!
    ```c++
    #include <iostream>
    using namespace std;

    #include <string>
    #include <cstdio>
    #include <map>

    map<char,int> Map;
    struct STR{
    string str;
    }Str[1000];

    string str;
    int nCount = 0,t = 0;
    int main(){
    while(getline(cin,str)){
    nCount ++;
    Str[nCount].str = str;
    for(int i = 0;i < str.length();i ++){
    Map[str[i]] ++;
    }
    }
    //计算t值
    int nMax = 0;
    char chMax;
    for(char ch = 'a';ch <= 'z';ch ++){
    if(nMax < Map[ch]){
    nMax = Map[ch];
    chMax = ch;
    }
    }
    t = chMax - 'e';
    if(t >= 0){
    for(int i = 1;i <= nCount;i ++){
    string str = Str[i].str;
    for(int j = 0;j < str.length();j ++){
    //大写
    if(str[j] >= 'A' && str[j] <= 'Z'){
    if(str[j] - t < 'A'){
    str[j] = 'Z' - (t - (str[j] - 'A')) + 1;
    }else{
    str[j] -= t;
    }
    }
    //小写
    else if(str[j] >= 'a' && str[j] <= 'z'){
    if(str[j] - t < 'a'){
    str[j] = 'z' - (t - (str[j] - 'a')) + 1;
    }else{
    str[j] -= t;
    }
    }
    }
    cout << str << endl;
    }
    }else{
    for(int i = 1;i <= nCount;i ++){
    string str = Str[i].str;
    for(int j = 0;j < str.length();j ++){
    //大写
    if(str[j] >= 'A' && str[j] <= 'Z'){
    if(str[j] + (-t) > 'Z'){
    str[j] = 'A' + (-t - ('Z' - str[j])) - 1;
    }else{
    str[j] += -t;
    }
    }
    //小写
    else if(str[j] >= 'a' && str[j] <= 'z'){
    if(str[j] + (-t) > 'z'){
    str[j] = 'a' + (-t - ('z' - str[j])) - 1;
    }else{
    str[j] += -t;
    }
    }
    }
    cout << str << endl;
    }
    }

    return 0;
    }
    ```

  • 0
    @ 2015-07-15 10:38:19

    var
    s:ansistring;
    num:array[1..26]of longint;
    ch:char;
    t,asc:integer;
    i,l:longint;
    flag:boolean;
    procedure check(c:char);
    var
    asc:integer;
    begin
    asc:=ord(c);
    if (asc>=65)and(asc<=90)then begin
    asc:=asc-65+1;
    asc:=((asc-t)+26)mod 26;
    if asc=0 then asc:=26;
    write(chr(asc+64));
    end else
    if (asc>=97)and(asc<=122)then begin
    asc:=asc-97+1;
    asc:=((asc-t)+26)mod 26;
    if asc=0 then asc:=26;
    write(chr(asc+96));
    end else write(c);
    end;
    procedure gett;
    var
    i,id:integer;
    max:longint;
    begin
    max:=0;
    for i:=1 to 26 do
    if num[i]>max then begin
    max:=num[i];
    id:=i;
    end;
    t:=id-5;
    end;
    begin
    i:=0;
    flag:=false;
    while not eof do begin
    inc(i);
    read(ch);
    s:=s+ch;
    asc:=ord(ch);
    if (asc>=65)and(asc<=90)then begin
    asc:=asc-65+1;
    inc(num[asc]);
    end else
    if (asc>=97)and(asc<=122)then begin
    asc:=asc-97+1;
    inc(num[asc]);
    end;
    end;
    gett;
    for l:=1 to i do check(s[l]);
    end.

  • 0
    @ 2015-04-12 18:57:45

    词频最高的是'e',处理一下不是字母的情况就行了

    Pascal Code

    var
    a:array[1..1000000] of char;
    i,t,n,temp:longint;
    j,maxc:char;
    hash:array['a'..'z'] of longint;
    hash2:array['a'..'z'] of char;
    begin
    //assign(input,'1.in');
    //reset(input);
    fillchar(hash,sizeof(hash),0);
    while not eof do
    begin
    inc(i);
    read(a[i]);
    if (a[i] in ['a'..'z']) or (a[i] in['A'..'Z']) then inc(hash[lowercase(a[i])]);
    end;
    n:=i;
    maxc:='a';
    for j:='b' to 'z' do
    if hash[j]>hash[maxc] then maxc:=j;
    t:=ord('e')-ord(maxc);
    for j:='a' to 'z' do
    begin
    temp:=ord(j)+t;
    if temp<ord('a') then inc(temp,26); //处理不是字母的情况
    if temp>ord('z') then dec(temp,26); //同上
    hash2[j]:=chr(temp);
    end;
    for i:=1 to n do
    begin
    if a[i] in ['a'..'z'] then begin write(hash2[a[i]]);continue;end;
    if a[i] in ['A'..'Z'] then begin write(upcase(hash2[lowercase(a[i])]));continue;end;
    write(a[i]);
    end;
    end.

  • 0
    @ 2012-11-09 15:43:42

    数据里有FPC的说明书。。。

  • 0
    @ 2012-10-27 11:10:02

    不是说情书吗,从Matrix67的名字入手居然是错的......

  • 0
    @ 2012-10-07 21:49:03

    find e....

    __ \ __ _|__

    / \ \/ /

    __/ | /__ .................

  • 0
    @ 2012-07-21 11:19:35

    TNND..我也是从名字下手的。结果挂了。。。

    看来只有统计出现最多的字母来计算密钥了。。靠。。。

  • 0
    @ 2009-11-09 17:28:19

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案错误...程序输出比正确答案长

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Unaccepted 有效得分:86 有效耗时:0ms

    为什么这样做不对???

    var

    c,x:char;i,j,n,t:longint;

    a:ansistring;

    b:array['a'..'z']of longint;

    begin

    a:='';

    while not eof do

    begin

    read(c); a:=a+c;

    if (c>='A')and(c='a')and(cn then begin n:=b[c];x:=c;end;

    t:=ord('e')-ord(x);

    for i:=1 to length(a) do

    if ((a[i]>='a')and(a[i]'z'then x:=chr(ord(x)-ord('z')+ord('a'))

    else if x='A')and(a[i]'Z'then x:=chr(ord(x)-ord('Z')+ord('A'))

    else if x

  • 0
    @ 2009-11-07 15:27:49

    BT题目

  • 0
    @ 2009-11-05 18:53:06

    怨念。残念。这都可以。

  • 0
    @ 2009-11-04 22:38:30

    穷举密文中出现次数最多的字母作为明文中的“e”即可

  • 0
    @ 2009-11-04 12:54:08

    Accepted 有效得分:100 有效耗时:0ms

    为什么'e'出现的次数一定会最多呢?还是诧异……

  • 0
    @ 2009-10-24 20:15:43

    统计词频=AC.

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

  • 0
    @ 2009-10-23 17:13:21

    Accepted 有效得分:100 有效耗时:0ms

    ___|\__|\__|begin\__|\__|

    这题我是用比较猥琐的的方法过的

    就是 t=ord('E')-ord(max(出现最多次数的字母数))

    要问为什么的话去问密码专家吧^_^(题目说过语法无错误的)

    再来就是转换了 相信大家应该会

    ___|\__|\__|^_^\___|_end.___|_

  • 0
    @ 2009-10-23 14:13:29

    ....

    Matrix67有帮人写情书的业务哦~~

    所以末尾署名不一定是他

    害我WA了一次

  • 0
    @ 2009-10-19 15:24:00

    一般人都不知道密码学的E吧

    我一开始还以为情书的结尾一定是matrix67的名字呢

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

信息

ID
1244
难度
4
分类
其他 点击显示
标签
(无)
递交数
964
已通过
392
通过率
41%
被复制
3
上传者