- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我不知道如何使用顶级编码器的离线可视化工具。这是我第一次尝试进行 topcoder 挑战。割草机挑战: https://community.topcoder.com/longcontest/?module=ViewProblemStatement&rd=16612&pm=14078
这是我在主类中使用的与可视化工具一起使用的内容:
public class Main {
public static void main(String[] args) {
LawnMowing lawnMowing = new LawnMowing();
int N;
int turnCost;
int forwardCost;
int slopeCost;
int startCol;
int startRow;
//System.out.println("Lawn Mower Begin:");
Scanner sc = new Scanner(System.in);
N = Integer.parseInt(sc.nextLine());
String[] yard = new String[N];
for (int i=0; i < N; i++){
yard[i] = (String) sc.nextLine();
}
turnCost = Integer.parseInt(sc.nextLine());
forwardCost = Integer.parseInt(sc.nextLine());
slopeCost = Integer.parseInt(sc.nextLine());
startCol = Integer.parseInt(sc.nextLine());
startRow = Integer.parseInt(sc.nextLine());
System.out.println();
String ret = lawnMowing.getMoves(yard, turnCost, forwardCost, slopeCost, startCol, startRow);
System.out.print(ret);
System.out.flush();
}
这是我为 getMoves() 函数设置的基本类
import java.util.Scanner;
public class LawnMowing {
public String getMoves(String[] yard, int turnCost, int forwardCost, int slopeCost, int startCol, int startRow){
String leftTurn = "L";
String rightTurn = "R";
String straight = "S";
String moves = "";
for(int i=0 ; i < 10; i++){
moves += leftTurn;
moves += straight;
moves += rightTurn;
moves += straight;
}
return moves;
}
}
这是我的终端命令:
Charless-MacBook-Pro:Documents Charles$ cd workspace
Charless-MacBook-Pro:workspace Charles$ ls
Graphics2 RemoteSystemsTempFiles
LawnMowing tester.jar
Charless-MacBook-Pro:workspace Charles$ cd LawnMowing
Charless-MacBook-Pro:LawnMowing Charles$ ls
bin src
Charless-MacBook-Pro:LawnMowing Charles$ cd src
Charless-MacBook-Pro:src Charles$ ls
LawnMowing.class LawnMowingVis.java Main.java
LawnMowing.java Main.class tester.jar
Charless-MacBook-Pro:src Charles$ java -jar tester.jar -exec "java -cp Main"
这是我的终端输出:
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server,
because you are running on a server-class machine.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A : separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
Warning: this feature is deprecated and will be removed
in a future release.
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed
in a future release.
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
ERROR: Unexpected error while running your test case.
java.lang.NullPointerException
at LawnMowingVis.runTest(LawnMowingVis.java:438)
at LawnMowingVis.main(LawnMowingVis.java:524)
请让我知道我做错了什么!
最佳答案
命令应该是:
java -jar tester.jar -exec "java -cp . Main"
有一个“。”在-cp
之后。 -cp
开关指定类路径,即当前目录(单个句点字符表示当前目录)。
关于java - TopCoder 使用离线可视化工具进行割草挑战,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35980672/
如果您熟悉 TopCoder,您就会知道您的源代码会获得最终的“成绩/分数”,这取决于时间、编译次数等,其中权重最高的一项是性能。但是他们如何测试,是否有某种简单的代码(java 或 c++)可以做到
我不知道如何使用顶级编码器的离线可视化工具。这是我第一次尝试进行 topcoder 挑战。割草机挑战: https://community.topcoder.com/longcontest/?modu
这段代码在 Topcoder 上给出了一个编译错误。在 code::blocks 上,它编译时有 0 个错误和 0 个警告,打印了 vector ,但它以非零值退出,这导致窗口显示“Interesti
我一直在努力解决the following TopCoder problem : You are playing a strategy game and you wish to train the s
我正在尝试理解问题 DivFreed2在 TopCoder 上: 它具体规定了数组 数组的长度为n。 每个元素都是 1 到 k 之间的整数,包括 1 和 k。 只要 A 和 B 是数组的两个连续元素(
这是一道来自 Topcoder SRM 566 Div2 的算法题。 问题可以查看here . 对于那些没有 topcoder 帐户的人,问题描述如下: Penguin Pals 是一项配对服务,使用
我正在尝试解决这个顶级编码器问题。看了解法分析还是看不懂。 解决方案的基本思路是逆向思考,插入元素而不是删除。但这如何降低问题的复杂性? 我明白这是一个动态规划问题。我在维基百科上读到,DP问题避免重
我正在尝试为 TopCoder 中的一个问题提交解决方案,这需要提交遵循其预定义的类和方法。由于我是 TopCoder 的新手,我主要是在尝试适应编码界面。这段代码在我的电脑上编译完美。不幸的是,在
下面的代码是一个流行的 topcoder 问题的答案 FourBlocks (您需要登录)。该解决方案使用位掩码内存来使用大小为 1 的 block 和大小为 4 的正方形 block 来查找网格中的
这是在 TopCoder 竞赛中使用的问题。我了解大部分解决方案,它本质上是在任何时间点跟踪特定节点的最佳解决方案,并且在到达目标节点后可以输出最佳解决方案。但是,该解决方案使用 BFS,我很困惑,因
自 HOURS 以来,我一直在努力思考这个 TopCoder 问题,但无法找到一个完美的解决方案,并找到了下面给出的一个使用得非常漂亮的解决方案! 我想弄清楚这个解决方案如何适用于给定的问题?而我当初
我最近加入了 TopCoder,过去几天一直在练习室练习。我遇到了这个我似乎无法解决的问题。任何帮助将不胜感激。 问题 The product value of a string is the pro
在TopCoder或ACM ICPC的比赛中编写中高难度程序的优秀程序员,在提交前必须确保算法的正确性。 虽然他们提供了一些示例测试用例来确保正确的输出,但是它如何保证程序会正确运行?他们可以自己写一
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
我是TopCoder的新手,想登录TopCoder Arena时很迷茫。 我已经注册并选择了我想参加 TopCoder 比赛,然后当我打开从网站下载的 jnlp 文件时。它显示了当前的登录页面。但是,
我想构建一个可下载的桌面软件,向用户显示带有示例问题的 GUI。 然后用户继续编写解决方案并将其粘贴到空白屏幕。 程序对其进行评估并给用户打分。用户进入下一级别。 我的问题是,这些网站如何评估程序的正
我想实现一个测试用例,它将运行特定的 java 类,然后向它提供输入并从中获取输出。 所以,这里有三个问题: 1) 我们如何从 junit 运行另一个 java 类?我们需要运行命令行来执行此操作吗?
我的以下代码适用于其他 https 站点,但不适用于 TopCoder。输出文件如下: Can't connect to community.topcoder.com:443 LWP::Protoco
我一直卡在问题grafixMask现在一天。这是我按照 DFS 教程中的伪代码编写的代码。我认为我的代码不遵守决定包含哪个网格的条件,导致错误的答案,但我不知道如何解决它。 #include
我正在尝试解决 JanuszInTheCasino problem其中一个测试用例 (test_one) 失败。我无法弄清楚问题所在。有什么想法吗? 代码如下: import java.util.Ma
我是一名优秀的程序员,十分优秀!