hqt

Untitled

hqt
Sep 27th, 2013
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.BufferedWriter;
  3. import java.io.File;
  4. import java.io.IOException;
  5. import java.io.InputStream;
  6. import java.io.InputStreamReader;
  7. import java.io.OutputStreamWriter;
  8. import java.io.PrintWriter;
  9. import java.math.BigInteger;
  10. import java.util.Scanner;
  11. import java.util.Stack;
  12. import java.util.StringTokenizer;
  13.  
  14. /**
  15. * <b> Algorithm on Codeforces. Problem C div 2 </b> </br>
  16. * @author Huynh Quang Thao
  17. *
  18. */
  19. public class Main {
  20.  
  21. public static void main(String[] args) throws Exception {
  22. Main main = new Main();
  23. main.run();
  24. }
  25.  
  26. public void run() throws Exception {
  27. Scanner sc = null;
  28. PrintWriter pr = null;
  29.  
  30. pr=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
  31. sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
  32. // sc = new Scanner(new File("input.txt"));
  33.  
  34. long n = sc.nextLong();
  35. long sum = 0;
  36. for (int i = 0; i < n; i++) {
  37. sum += sc.nextLong();
  38. }
  39.  
  40. if (sum % (n-1) == 0) System.out.println(sum / (n-1));
  41. else System.out.println(sum / (n-1) + 1);
  42.  
  43. pr.close();
  44. sc.close();
  45.  
  46. }
  47.  
  48. static class Team {
  49. int baloon;
  50. int rA;
  51. int rB;
  52. public Team(int baloon, int rA, int rB) {
  53. this.baloon = baloon;
  54. this.rA = rA;
  55. this.rB = rB;
  56. }
  57. }
  58.  
  59. static class InputReader {
  60. public BufferedReader reader;
  61.  
  62. public StringTokenizer tokenizer;
  63.  
  64. public InputReader(InputStream stream) {
  65. reader = new BufferedReader(new InputStreamReader(stream));
  66. tokenizer = null;
  67. }
  68.  
  69. public String next() {
  70. while (tokenizer == null || !tokenizer.hasMoreTokens()) {
  71. try {
  72. tokenizer = new StringTokenizer(reader.readLine());
  73. }
  74. catch (IOException e) {
  75. throw new RuntimeException(e);
  76. }
  77. }
  78. return tokenizer.nextToken();
  79. }
  80.  
  81. public int nextInt() {
  82. return Integer.parseInt(next());
  83. }
  84.  
  85. public double nextDouble() {
  86. return Double.parseDouble(next());
  87. }
  88.  
  89. public float nextFloat() {
  90. return Float.parseFloat(next());
  91. }
  92.  
  93. public long nextLong() {
  94. return Long.parseLong(next());
  95. }
  96.  
  97. public BigInteger nextBigInteger() {
  98. return new BigInteger(next());
  99. }
  100.  
  101. }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment