增加GraphViz文本编辑器字体大小Windows(Increase GraphViz text editor font size Windows)
有没有办法在GraphViz中增加文本编辑器字体的大小和字体? 默认字体太小,无法轻松编辑。
Is there a way to increase size and typeface of the text editor font in GraphViz? The default font is too small for easy editing.
原文:https://stackoverflow.com/questions/45193777
最满意答案
首先,返回值必须是
BigInteger
,因为C(1000,900)
远远超过int
的范围。其次,您不需要单独的
factorial()
方法。 在迭代时进行除法将通过不创建过大的中间值来增加内存占用(以执行多个分区为代价,但即便如此,它实际上可能更快)。像这样:
static BigInteger cSelect(int x, int y) { BigInteger v = BigInteger.ONE; for (int i = x, j = 1; j <= y; i--, j++) v = v.multiply(BigInteger.valueOf(i)).divide(BigInteger.valueOf(j)); return v; }
通过向下计数和向上计数,将不会有分数的一小部分。
测试
System.out.println(cSelect(10, 2)); System.out.println(cSelect(1000, 900));
产量
45 63850511926305130236698511142022274281262900693853331776286816221524376994750901948920974351797699894319420811933446197797592213357065053890
First, return value must be
BigInteger
, because result ofC(1000,900)
far exceeds the range on anint
.Second, you don't need separate
factorial()
method. Doing the division as you iterate will improve memory footprint by not creating excessively large intermediate values (at cost of doing multiple divisions, but even so it might actually be faster).Like this:
static BigInteger cSelect(int x, int y) { BigInteger v = BigInteger.ONE; for (int i = x, j = 1; j <= y; i--, j++) v = v.multiply(BigInteger.valueOf(i)).divide(BigInteger.valueOf(j)); return v; }
By counting
i
down andj
up, there will never be a fraction from the division.Test
System.out.println(cSelect(10, 2)); System.out.println(cSelect(1000, 900));
Output
45 63850511926305130236698511142022274281262900693853331776286816221524376994750901948920974351797699894319420811933446197797592213357065053890
相关问答
更多-
Java Compute C(n,k)和具有biginteger的factorial(Java Compute C(n,k) and factorial with biginteger)[2023-08-29]
首先,返回值必须是BigInteger ,因为C(1000,900)远远超过int的范围。 其次,您不需要单独的factorial()方法。 在迭代时进行除法将通过不创建过大的中间值来增加内存占用(以执行多个分区为代价,但即便如此,它实际上可能更快)。 像这样: static BigInteger cSelect(int x, int y) { BigInteger v = BigInteger.ONE; for (int i = x, j = 1; j <= y; i--, j++) ... -
根据RSA上的Wikipedia页面,对e和d的要求并不是它们的产品与1(mod n )一致,而是它们的产品必须与1(modφ( n ))一致。 这是2个素数相乘的总函数,即(p - 1)(q - 1)或997800120。 ed ( 32589339 ( n ))的结果不是1 ,它是32589339 。 原因是你的较小数字工作是因为5和11的φ( n )是4 * 10 = 40,而7 * 23(mod 40)是1 。 您需要为您的大号选择适当的d常数。 这是关于φ(n)的e的模逆,可以用BigIntege ...
-
问题是if条件下的字符串比较。 如果条件改为以下: if(fact.intValue() == 1) { The problem is with String comparison in if condition. Change that if condition to the following: if(fact.intValue() == 1) {
-
你的for循环没有递增它们的索引,因此将永远循环。 i.add(BigInteger.ONE)不会改变i ,它会创建一个新的 BigInteger并返回它 。 如果要增加i的值,则需要编写i = i.add(BigInteger.ONE) 这意味着当您尝试初始化数组时,您将进入无限循环,您将永远重新初始化doubledim[0] 。 例如 for (k = BigInteger.ZERO; k.compareTo(no) < 0; k.add(BigInteger.ONE)) { doubledim ...
-
关于Java BigInteger(about Java BigInteger)[2022-07-04]
BigInteger类将整数表示为不可变对象。 这里有两点。 不要使用==来测试两个BigInteger是否相等 要更改BigInteger变量的值,您必须执行i = i.add(ONE); 而不只是i.add(ONE); 。 不使用==来比较BigInteger的原因是因为不是检查数值相等而是检查它们是否是内存中的同一对象。 考虑使用String s。 String a = "a"; String b = "b"; String x = a + b; String y = "ab"; 在上面的示例中, ... -
如何使用BigInteger类?(How to use BigInteger class?)[2023-04-09]
在factorial函数中使用BigInteger ,而不是“在完成计算后”。 还要注意,当乘以BigInteger ,请使用BigInteger.multiply(BigInteger val)方法而不是* 。 这里是改变的方法,除了使用BigInteger而不是int外,它和你的完全一样: public static BigInteger factorial(int n){ int index = n; BigInteger total = BigInteger.valueOf(1); wh ... -
你应该开始你的循环,我= 0和currentPi = 0。 // ... BigDecimal currentPi = BigDecimal.ZERO; // ... for(int i = 0; i < 1000; i++) { // ... } // ... 这给出: 3.1415926535897930237 ... You should start your loop with i = 0. and with currentPi = 0. // ... BigDecimal current ...
-
用两个参数计算n的使用范围的阶乘[重复](Compute the factorial of n using range with two parameters [duplicate])[2023-11-27]
你只是忘记了:在你的范围函数之后,因为它是一个for循环^。^ You simply forgot a : after your range function since it is a for loop ^.^ -
问题在于你的基本情况; n (这是一个BigInteger )不会等于"0" (这是一个String )。 所以你继续到else块,重新诅咒。 此外, BigInteger包含ONE和ZERO常量,因此您可以编写类似的东西 public static BigInteger fact(BigInteger n) { if (n.equals(BigInteger.ZERO) || n.equals(BigInteger.ONE)) return BigInteger.ONE; ...
-
在研究了可用的JVM选项列表之后,我发现一个添加到8u40的选项可以准确地打开/关闭所需的内在函数。 下面是-XX:-UseMultiplyToLenIntrinsic结果-XX:-UseMultiplyToLenIntrinsic对于8u40非常接近8u31的结果: [info] JavaFactorial.recursion 1000 thrpt 5 12.521 ± 3.352 ops/ms [info] JavaFactoria ...