noip2002 string transformation

Updated on educate 2024-08-08
6 answers
  1. Anonymous users2024-02-15

    Use the folding method (adding the ASCII codes of the individual characters), but this is more likely to collide.

    You can tie the hash function to the length, first and last parameters of the string, etc., so that it is more random.

    Encyclopedia: Folding method.

    Splitting a keyword into parts with the same number of digits (the last part can have different digits) and then taking the sum of these parts (rounding off) as the hash address, this method is called folding.

    For example, every Western book has an international standard book number, which is a 10-digit decimal number, and if you want to use it as a keyword to build a hash table, when the library has less than 10,000 titles, you can use this method to construct a four-digit hash function.

  2. Anonymous users2024-02-14

    Why do you want to go both ways? You can search directly.,Every time for all the strings that can be changed.,Change it.,If it's heavy, you can map or hash.。

  3. Anonymous users2024-02-13

    Simple Deep Search. Pass 3 parameters. One passes the subscript of the currently selected number, one passes the sum of the selected number, and one passes the sum of the selected number.

    #include

    #include

    using namespace std;

    const int maxn = 22;

    int a[maxn];

    int ans,n,k;

    bool isprim(int num)

    void dfs(int cur,int cnt,int num)return ;

    for(int i=cur;i<=n;i++)int main()

  4. Anonymous users2024-02-12

    varmap:array[-1..9,-1..5] of boolean;The subscript of the second dimension of map is up to 5

    num:array[-1..9,-1..5] of longint;The subscript of the second dimension of num is up to 5

    i,j,n,m,x,y:longint;

    beginfillchar(map,sizeof(map),true);

    readln(n,m,x,y);

    for i:=-1 to 9 do

    beginmap[-1,i]:=false;The subscript for the second dimension of map needs to be 9

    map[5,i]:=false;

    end;for j:=-1 to 5 do

    beginmap[-1,j]:=false;

    map[9,j]:=false;

    end;map[x+2,y+1]:=false;

    map[x+1,y+2]:=false;

    map[x-1,y+1]:=false;

    map[x-2,y+1]:=false;

    map[x-2,y-1]:=false;

    map[x-1,y-1]:=false;

    map[x+1,y-2]:=false;

    map[x+2,y-1]:=false;

    num[0,0]:=1;

    for i:=0 to n do

    for j:=0 to m do

    Beginif map[i,j]=false then num[i,j]:=0 The subscript of the first dimension of the Else Map is taken to n, and the subscript of the second dimension is taken to m

    beginnum[i,j]:=num[i-1,j]+num[i,j-1];The subscript of the first dimension of num is taken to n, and the subscript of the second dimension is taken to m

    end;if (i=1) and (j=0) then num[i,j]:=1;

    end;writeln(num[i,j]);

    end.

  5. Anonymous users2024-02-11

    ……map:array[-1..9,-1..5] of boolean;

    You should be fine if you change -1 to -2.

  6. Anonymous users2024-02-10

    This question cannot be arranged quickly, and using it will shuffle the order and lead to errors. Examples:

    10,8,17,5 is 2 times, 5 8 10 17 is 3 times, you kind of like a merge fruit.

Related questions
17 answers2024-08-08

Answers that directly output sample data may work, but samples are not necessarily included in the test data. >>>More

9 answers2024-08-08

Normally, I don't write, but if I write, I have to write well. >>>More

11 answers2024-08-08

3 Detention of criminals.

Type: Data structure - and look up the set (there are many ways to do it, and it can also be thought of as a dichotomous graph + dichotomous answer). >>>More

8 answers2024-08-08

The main tests of the preliminary round are: basic knowledge of computer development, proficient application of computer language grammar, simple application of data structures, basic content of combinatorial mathematics, inference, analysis and other abilities. >>>More

7 answers2024-08-08

1. Read 2 positive integers within 100 from the keyboard, multiply and output vertically. >>>More