社区讨论
我感觉我的代码没问题啊,为什么报错RE呢?
P3392涂条纹参与者 1已保存回复 0
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 0 条
- 当前快照
- 1 份
- 快照标识符
- @lobaizee
- 此快照首次捕获于
- 2023/10/29 17:50 2 年前
- 此快照最后确认于
- 2023/11/03 23:46 2 年前
JAVA
import java.io.*;
public class Main{
static int count = Integer.MAX_VALUE;
static StringBuilder str = new StringBuilder();
static BufferedReader ins = new BufferedReader(new InputStreamReader(System.in));
static StreamTokenizer in = new StreamTokenizer(ins);
static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws IOException{
int cl = 0;
in.nextToken();
int n = (int)in.nval;
in.nextToken();
int m = (int)in.nval;
String[] strings = new String[n];
for(int i = 0;i<strings.length;i++)
{
strings[i] = ins.readLine();
}
for(int i = 1;i<=strings.length-2;i++)
{
for(int i2 = i+1;i2<=strings.length-1;i2++)
{
for(int i4 = 0;i4<i;i4++)
{
for(int t1 = 0;t1<m;t1++)
{
if(strings[i4].charAt(t1) != 'W')
{
cl++;
}
}
}
for(int i5 = i;i5<i2;i5++)
{
for(int t1 = 0;t1<m;t1++)
{
if(strings[i5].charAt(t1) != 'B')
{
cl++;
}
}
}
for(int i6 = i2;i6<n;i6++)
{
for(int t1 = 0;t1<m;t1++)
{
if(strings[i6].charAt(t1) != 'R')
{
cl++;
}
}
}
count = Math.min(cl, count);
cl = 0;
}
}
out.print(count);
out.close();
}
}
回复
共 0 条回复,欢迎继续交流。
正在加载回复...