如何创建看起来像这样的列表:
1. Topic 1.1 First Subtopic 1.2 Second Subtopic
我尝试使用枚举列表
\begin{enumerate}
\item Topic
\begin{enumerate}
\item First Subtopic
\item Second Subtopic
\end{enumerate}
\end{enumerate}
Run Code Online (Sandbox Code Playgroud)
但输出看起来像:
1. Topic (a) First Subtopic (b) Second Subtopic
那我该如何获得清单呢?是否有另一个列表环境或可能是额外的包?
请看以下示例:
public void init() {
final Environment env = new Environment();
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
env.close();
}
});
}
Run Code Online (Sandbox Code Playgroud)
首先,env
存储在哪里?是吗:
我的猜测是第一个选择.
其次,执行这样做会产生任何性能问题(而不是简单地创建env
类的成员变量并引用它),特别是如果要创建大量引用最终局部变量的内部类构造.
以下程序无法在gcc中编译.但它与g ++和MSC++的.c
扩展编译正常.
#include <math.h>
#include <stdio.h>
int main()
{
double t = 10;
double t2 = 200;
printf("%lf\n", sqrt(t*t2));
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我的系统是CentOS,版本信息.
> gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Run Code Online (Sandbox Code Playgroud)
错误信息:
> gcc test.c
/tmp/ccyY3Hiw.o: In function `main':
test.c:(.text+0x55): undefined reference to `sqrt'
collect2: …
Run Code Online (Sandbox Code Playgroud) 如何execlp()
使用可变数量的参数调用不同的进程?
我想参加像代码高尔夫比赛这样的比赛,但获胜者将拥有最快的算法,而不是最小的代码.
例如,代码
public class simple {
public static int main(String argc[]) {
int i;
i = 3;
while (i > 0) {
i--;
}
return 0;
}
}
Run Code Online (Sandbox Code Playgroud)
生成JVM代码
0: iconst_3
1: istore_1
2: iload_1
3: ifle 12
6: iinc 1, -1
9: goto 2
12: iconst_0
13: ireturn
Run Code Online (Sandbox Code Playgroud)
它需要(如果我已经正确计算)18个JVM指令来运行.
我希望人们能够在家里办理他们的参赛作品,看看评委会看到什么.显然,如果我将输入提供给程序,最快的解决方案是吐出记忆的预先计算的答案.有没有办法客观地让人们在家里运行程序而不是看到回忆的答案?
还有哪些其他问题阻碍了非正式的"最快的代码竞争"的发生?
谢谢!
我正在调试的python程序具有以下代码(包括print
用于调试的语句):
print "BEFORE..."
print "oup[\"0\"] = " + str(oup["0"])
print "oup[\"2008\"] = " + str(oup["2008"])
print "oup[\"2009\"] = " + str(oup["2009"])
oup0 = oup["0"]
oup2008 = oup["2008"]
oup2009 = oup["2009"]
ouptotal = oup2008 + oup2009
print "ouptotal = " + str(ouptotal)
if ouptotal > 0:
oup["2008"] = oup2008 + oup0 * (oup2008 / ouptotal)
oup["2009"] = oup2009 + oup0 * (oup2009 / ouptotal)
print "AFTER..."
print "oup[\"0\"] = " + str(oup["0"])
print "oup[\"2008\"] = " + str(oup["2008"])
print …
Run Code Online (Sandbox Code Playgroud)