poj1979 测试用例全通过,但提交就是WA,无解。
来源:互联网 发布:王柳雯淘宝店 编辑:程序博客网 时间:2024/05/16 08:13
Hello,everybody,我是越爱越难,最近做POJ1979,提交时总是WA,所有的测试数据都通过了,我自己又反复看了几遍代码,感觉没毛病,扎心了!望老铁们来帮我一把!以下附上我写的Java代码。
import java.util.Scanner;public class CopyOfRedAndBlack { static int m,n; static char[][] c = new char[25][25]; static int sum=0; public static void main(String[] args) { Scanner scan = new Scanner(System.in); n = scan.nextInt(); m = scan.nextInt(); while(n>0&&m>0) { sum = 0; int x = -1,y = -1; for(int i=0; i<m; i++) { String s = new String(""); s = scan.next(); c[i] = s.toCharArray(); if(x==-1) { int j = s.indexOf('@'); if(j>0) { x = i; y = j; } } } solve(x,y); System.out.println(sum); n = scan.nextInt(); m = scan.nextInt(); } scan.close(); } public static void solve(int x,int y) { if(x>=0&&x<m&&y>=0&&y<n) { if(c[x][y]=='.'||c[x][y]=='@') { sum++; solve(x+1,y); solve(x,y-1); solve(x-1,y); solve(x,y+1); } } }}
0 0
- poj1979 测试用例全通过,但提交就是WA,无解。
- #1094 : Lost in the City(测试用例正确,但提交显示WA,求发现我程序错误)
- Domino SSO配置无问题,但就是不生效
- POJ-2365(用例通过,但一直WA,参考的方法没有太看懂)
- POJ-3300(用例通过,但不知什么原因一直WA)
- POJ1979
- poj1979
- POJ1979
- POJ1979
- poj1979
- poj1979
- poj1979
- poj1979
- poj1979
- poj1979
- poj1979
- 【POJ1979】
- poj1979
- Maven instal Could not resolve dependencies for project 找不到本地仓库下的jar
- CF
- 最小堆最大堆的详细解读
- MyBatis学习笔记(一)
- Android Studio中导入SlidingMenu(详解)
- poj1979 测试用例全通过,但提交就是WA,无解。
- 两台不同网段的PC直连是否可以相互ping通
- 倍增二分——玲珑学院OJ #1112
- 数据挖掘:K近邻
- 2016陕西省省赛 ACM Rui and her functions B 二分
- 修改linux(centos7)操作系统静态ip
- CF
- The connection to adb is down, and a severe error has occured.解决方法
- 农民种地(图的搜索)