# 2729: [HNOI2012]排队

## 2729: [HNOI2012]排队

Time Limit: 10 Sec  Memory Limit: 128 MB

Submit: 957  Solved: 449

[Submit][Status]

1 1

12

## Source

day1

``` 1 /**************************************************************
2     Problem: 2729
3     User: HansBug
4     Language: Pascal
5     Result: Accepted
6     Time:1920 ms
7     Memory:1008 kb
8 ****************************************************************/
9
10 type
11         arr=array [0..100001] of longint;
12 var
13         i,j,k,l,m,n,a1,a2,a3,a4:longint;
14         a,b:arr;
15 procedure multy (var a:arr; b:longint);inline;
16 var
17         i:longint;
18 begin
19         for i:=1 to a[0] do a[i]:=a[i]*b;
20         i:=1;
21         while (i<=a[0])or(a[i]>0) do
22                 begin
23                         a[i+1]:=a[i+1]+a[i] div 10;
24                         a[i]:=a[i] mod 10;
25                         inc(i);
26                 end;
27         dec(i);
28         a[0]:=i;
29 end;
30
32 var
33         i,k:longint;
34 begin
35         if a[0]>b[0] then k:=a[0] else k:=b[0];
36         for i:=1 to k do
37                 begin
38                         a[i]:=a[i]+b[i];
39                         a[i+1]:=a[i+1]+a[i] div 10;
40                         a[i]:=a[i] mod 10;
41                 end;
42         if a[k+1]<>0 then inc(k);
43         a[0]:=k;
44 end;
45
46 begin
48         if (n=0)and(m=0) then begin writeln(0);halt; end;
49     fillchar(b,sizeof(b),0);
50         b[1]:=1;  b[0]:=1;
51         multy(b,n+1);
52         multy(b,2);
53         multy(b,m);
54         for i:=n+2-m+2 to n+2 do multy(b,i);
55         a:=b;
56         fillchar(b,sizeof(b),0);
57         b[0]:=1;  b[1]:=1;
58         multy(b,n+1);
59         multy(b,n);
60         for i:=n+4-m to n+3 do multy(b,i);
62         for i:=2 to n do multy(a,i);
63         for i:=a[0] downto 1 do write(a[i]);
64         writeln;
65 end.  ```

251 篇文章37 人订阅

0 条评论

## 相关文章

40250

27630

### HYSBZ 2160 拉拉队排练（回文树）

2160: 拉拉队排练 Time Limit: 10 Sec  Memory Limit: 259 MB Submit: 825  Solved: 324 [...

36270

19430

25050

### Sweet Snippet 之 Bounce Setting

又是一篇Sweet Snippet，自己看来都觉得过小，不足以成篇，不过自觉有些趣味，也就随便记一记了，权当自娱自乐 ：）

7410

10710

### CodeForces 982F：The Meeting Place Cannot Be Changed（有向图）

Petr is a detective in Braginsk. Somebody stole a huge amount of money from a ba...

10610

35280

20800