Submission #864114
Source Code Expand
public class Main { public static void main(String[] args) throws java.io.IOException { new Main().run(); } private void run() throws java.io.IOException { MySystemScanner sc = new MySystemScanner(); // MySystemScanner sc = new MySystemScanner("input.txt"); /////////////////////////////////////////////////////////////// while (sc.getLine() != null) { int m = sc.getInt(); if (m < 100) { m = 0; } else if (m <= 5000) { m = (int) ((m / 1000.0) * 10); } else if (m <= 30000) { m = (m / 1000) + 50; } else if (m <= 70000) { m = ((m / 1000) - 30) / 5 + 80; } else { m = 89; } System.out.println(String.format("%02d", m)); } /////////////////////////////////////////////////////////////// sc.close(); // sc2.close(); } class MySystemScanner { /** * @param streamReader * InputStreamReader based on System.in * @param reader * BufferedReader based on streamReader * @param currentString * String current using * @param splitCurrentString * split currentString using delimiter * @param nextIndex * index of next element * @param delimiter * delimiter used for split */ private java.io.InputStreamReader streamReader = new java.io.InputStreamReader(System.in); private java.io.BufferedReader reader = new java.io.BufferedReader(streamReader); private String currentString = null; private String[] splitCurrentString = null; private int nextIndex = 0; private String delimiter = "[ -]+"; /* simple Constructor */ public MySystemScanner() { initialize(); } /* Constructor using FileStream */ public MySystemScanner(String FileName) { close(); try { streamReader = new java.io.FileReader(FileName); reader = new java.io.BufferedReader(streamReader); initialize(); } catch (java.io.FileNotFoundException e) { } } /* initialize :: split & reset nextIndex */ private void initialize() { // if error occurred, retry try { currentString = reader.readLine(); if (currentString != null) { splitCurrentString = currentString.split(delimiter); nextIndex = 0; } } catch (java.io.IOException e) { initialize(); } } /* setDelimiter :: to set delimiter & initialize */ public void setdelimiter(String designatedDelimiter) { delimiter = designatedDelimiter.toString(); initialize(); } /* hasNext :: there is next element or not */ public boolean hasNext() { return currentString != null; } /* goNextLine :: go to next Line */ public void goNextLine() { initialize(); } /* getInt :: return nextInteger */ public int getInt() { int ret = 0; if (currentString != null && hasNext()) { ret = Integer.parseInt(splitCurrentString[nextIndex++]); } else { errMessage("Cant Return INTEGER !"); } if (nextIndex == splitCurrentString.length) { goNextLine(); } return ret; } /* getDouble :: return nextDouble */ public double getDouble() { double ret = 0; if (currentString != null && hasNext()) { ret = Double.parseDouble(splitCurrentString[nextIndex++]); } else { errMessage("Cant Return DOUBLE !"); } if (nextIndex == splitCurrentString.length) { goNextLine(); } return ret; } /* getString :: return nextString */ public String getString() { String ret = null; if (currentString != null && hasNext()) { ret = splitCurrentString[nextIndex++].toString(); } else { errMessage("Cant Return STRING !"); } if (nextIndex == splitCurrentString.length) { goNextLine(); } return ret; } /* getLine :: return currentString */ public String getLine() { return currentString; } /* isNextInt :: if can next element is Integer or not */ public boolean isNextInt() { try { Integer.parseInt(splitCurrentString[nextIndex]); } catch (NumberFormatException e) { return false; } return true; } /* isNextDouble :: if can next element is Double or not */ public boolean isNextDouble() { try { Double.parseDouble(splitCurrentString[nextIndex]); } catch (NumberFormatException e) { return false; } return true; } /* errMessage :: to put error message */ private void errMessage(String type) { System.out.println("ERROR:" + type); System.out.println("Current Condition"); System.out.println("* CurrentString:" + currentString); System.out.println("* CurrentSource:" + splitCurrentString[nextIndex - 1]); System.out.println("Exit..."); close(); System.exit(-1); } /* close Method :: to close stream */ /* !! MUST CALL THIS METHOD !! */ public void close() { try { reader.close(); streamReader.close(); } catch (java.io.IOException e) { System.out.println("Error: Cant close stream!"); System.out.println("Exit."); System.exit(-1); } } } }
Submission Info
Submission Time | |
---|---|
Task | B - 視程の通報 |
User | oblivion |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 5246 Byte |
Status | AC |
Exec Time | 474 ms |
Memory | 21252 KB |
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
all | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 474 ms | 21140 KB |
00_sample_02.txt | AC | 324 ms | 21152 KB |
00_sample_03.txt | AC | 325 ms | 21160 KB |
test_01.txt | AC | 320 ms | 21228 KB |
test_02.txt | AC | 320 ms | 21140 KB |
test_03.txt | AC | 324 ms | 21172 KB |
test_04.txt | AC | 380 ms | 21136 KB |
test_05.txt | AC | 335 ms | 21216 KB |
test_06.txt | AC | 324 ms | 21044 KB |
test_07.txt | AC | 331 ms | 21248 KB |
test_08.txt | AC | 349 ms | 21036 KB |
test_09.txt | AC | 322 ms | 21216 KB |
test_10.txt | AC | 323 ms | 21116 KB |
test_11.txt | AC | 319 ms | 21232 KB |
test_12.txt | AC | 347 ms | 21228 KB |
test_13.txt | AC | 319 ms | 21144 KB |
test_14.txt | AC | 318 ms | 21224 KB |
test_15.txt | AC | 318 ms | 21160 KB |
test_16.txt | AC | 324 ms | 21240 KB |
test_17.txt | AC | 319 ms | 21252 KB |
test_18.txt | AC | 318 ms | 21176 KB |
test_19.txt | AC | 315 ms | 21248 KB |
test_20.txt | AC | 318 ms | 21156 KB |
test_21.txt | AC | 320 ms | 21228 KB |
test_22.txt | AC | 321 ms | 21216 KB |
test_23.txt | AC | 324 ms | 21168 KB |
test_24.txt | AC | 318 ms | 21228 KB |
test_25.txt | AC | 325 ms | 21196 KB |
test_26.txt | AC | 323 ms | 21168 KB |
test_27.txt | AC | 319 ms | 21128 KB |
test_28.txt | AC | 317 ms | 21128 KB |
test_29.txt | AC | 320 ms | 21200 KB |
test_30.txt | AC | 317 ms | 21216 KB |
test_31.txt | AC | 323 ms | 21144 KB |
test_32.txt | AC | 338 ms | 21168 KB |
test_33.txt | AC | 319 ms | 21136 KB |
test_34.txt | AC | 321 ms | 21152 KB |
test_35.txt | AC | 326 ms | 21140 KB |