C - Online Judge,java半实现
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了C - Online Judge,java半实现,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1738字,纯文字阅读大概需要3分钟。
内容图文
![C - Online Judge,java半实现](/upload/InfoBanner/zyjiaocheng/766/f973165d351d4bb0b76ecc70fea029d7.jpg)
package stringTrain;
import java.util.Scanner;
//没有实现读入里面按照“start”和“end”来分
public class problemC {
public static String pure(char a[]) {
String s = "";
for (int i = 0; i < a.length; i++) {
if (a[i] != ' ') {
s += a[i];
}
}
return s;
}
public static boolean same(char a[], char a2[]) {
int y = 0;
if (a.length == a2.length) {
for (int i = 0; i < a2.length; i++) {
if (a[i] != a2[i]) {
y = 0;
break;
}
}
} else {
y = 0;
}
if (y == 0) {
return false;
} else {
return true;
} // accept
}
public static boolean same2(char a[], char a2[]) {
int y = 0;
String s1 = pure(a);
String s2 = pure(a2);
char a3[] = s1.toCharArray();
char a4[] = s1.toCharArray();
if (same(a3, a4)) {
y = 1;
}
if (y == 0) {
return false;
} else {
return true;
} // "Presentation Error"
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
String s1, cor, s2, s3, user, s4 = "";
for (int i = 0; i < t; i++) {
s1 = in.nextLine();
cor = in.nextLine();
s2 = in.nextLine();
s3 = in.nextLine();
user = in.nextLine();
s4 = in.nextLine();
char a[] = cor.toCharArray();
char a2[] = user.toCharArray();
if (same(a, a2)) {
System.out.println("Accepted");
} else {
if (same2(a, a2)) {
System.out.println("Presentation Error");
} else {
System.out.println("Wrong Answer");
}
}
}
}
}
Ignatius is building an Online Judge, now he has worked out all the problems except the Judge System. The system has to read data from correct output file and user’s result file, then the system compare the two files. If the two files are absolutly same, then the Judge System return “Accepted”, else if the only differences between the two files are spaces(’ ‘), tabs(’\t’), or enters(’\n’), the Judge System should return “Presentation Error”, else the system will return “Wrong Answer”.
内容总结
以上是互联网集市为您收集整理的C - Online Judge,java半实现全部内容,希望文章能够帮你解决C - Online Judge,java半实现所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。