I tried your code, it returns WA(Wrong answer) instead of RE(Runtime Error)
Please check if you selected the correct language. You should use Java(OpenJDK) Pandelis <[email protected]> 于2020年1月13日周一 上午7:28写道: > Hey all, > I am new to this. I tried submitting the code for one of the Kick Start > problems; I keep on getting a run-time error from google, but when I run > the code on my machine it executes perfectly. Can someone help me out? > > code : > > import java.util.*; > import java.io.*; > > class Section { > private int id; > private int value; > private boolean painted; > > public Section( int id, int value ) { > this.id = id; > this.value = value; > this.painted = false; > } > > public int getId() { > return this.id; > } > public int getValue() { > return this.value; > } > > public void paint() { > this.painted = true; > } > > } > > class Solution { > > public static void main(String[] args) throws Exception { > int testCases; > int wordSize; > String word; > int totalBeauty; > > Section[] wall; > > int tmpTotalBeauty; > > Scanner in = new Scanner(new BufferedReader(new > InputStreamReader(System.in))); > testCases = in.nextInt(); > > for (int count = 0; count < testCases; count++) { > wordSize = in.nextInt(); > in.nextLine(); // flush > word = in.nextLine(); > totalBeauty = 0; > wall = new Section[wordSize]; > > for (int i = 0; i < wall.length; i++) { > wall[i] = new Section( i, Character.getNumericValue( > word.charAt( i ) ) ); > } > > for (int pivot = 0; pivot < (wordSize+1)/2; pivot++) { > tmpTotalBeauty = 0; > > for (int i = 0; i < (wordSize+1)/2; i++) { > //System.out.println(wall[pivot+i].getValue()); > tmpTotalBeauty += wall[pivot+i].getValue(); > } > if (totalBeauty < tmpTotalBeauty) { > totalBeauty = tmpTotalBeauty; > } > } > > > System.out.println("Case #" + (count+1) + ": " + totalBeauty); > } > > //in.close(); > > } > } > > -- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-code/b18b3e1d-70fb-4585-9efe-aab56a72ccf4%40googlegroups.com > <https://groups.google.com/d/msgid/google-code/b18b3e1d-70fb-4585-9efe-aab56a72ccf4%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/CAGDEU-KoVg5L87f96hcUSs1sYne5LezmHSmXKYgozKG%2BHfyutg%40mail.gmail.com.
