[Offer收割]编程练习赛21 register

Ended

Participants:295

Verdict:Time Limit Exceeded
Score:80 / 100
Submitted:2017-08-06 14:29:12

Lang:C#

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
    public class Program
    {
        public static long[] table = new long[100010];
        public static int maxN = 0;
        public static int mod = 1000000007;
        public static long Func(int n)
        {
            if (n < 0)
                return 1;
            if (n <= maxN)
                return table[n];
            long res = table[maxN];
            for (int i = maxN + 1; i <= n; ++i)
            {
                res = (res << 1) % mod;
                table[i] = res;
            }
            maxN = n;
            return table[n];
        }
        public static void Main()
        {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX