2016-12-03 40 views
-4

我可以在C++中獲得ac,但無法在java中獲得ac。我只是-7每個字符,但'\ n'和'\ r'.can有人顯示在Java中的交流解決方案的代碼?無法在java中獲得uva 458的ac

+0

StackOverflow不是詢問競賽網站答案的正確位置。 – apnorton

回答

-1
public void Decoder(){ 
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); 
    String line = null; 
    char sequence[]; 
    int n = 0; 

    while((line = reader.readLine()) != null) { 
     sequence = line.toCharArray(); 
     n = sequence.length; 
     for (int i = 0; i < n; i++) { 
      sequence[i] = (char) (((sequence[i] - 32 - 7) % 95) + 32); 
     } 
     System.out.println(sequence); 
    } 
} 
+0

爲什麼投票:( –