相关疑难解决方法(0)

boolean []与BitSet:哪个更有效?

什么在内存和CPU使用方面更有效 - 一个booleans或BitSet 数组?不使用特定的BitSet方法,只对数组进行get/set/clear(==,=,Arrays.fill).

java memory arrays performance bitsets

63
推荐指数
5
解决办法
4万
查看次数

第n个素数问题,需要加快一点

有简单的密码将数字翻译成系列 . ( )

为了加密这个表示的数字(0 ... 2147483647),我(我想)我需要:

  • 素数分解
  • 对于给定的p(p是Prime),p的顺序(即PrimeOrd(2) == 0,PrimeOrd(227) == 49)

一些例子

    0   .                  6    (()())
    1   ()                 7    (...())
    2   (())               8    ((.()))
    3   (.())              9    (.(()))
    4   ((()))            10    (().())
    5   (..())            11    (....())
    227 (................................................())
    2147483648    ((..........()))

我的问题源代码


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

static class P
{
    static List<int> _list = new List<int>();

    public static int Nth(int n)
    { …
Run Code Online (Sandbox Code Playgroud)

c# optimization performance primes prime-factoring

3
推荐指数
2
解决办法
2041
查看次数