Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.BufferedWriter;
- import java.io.File;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.InputStreamReader;
- import java.io.OutputStreamWriter;
- import java.io.PrintWriter;
- import java.math.BigInteger;
- import java.util.Scanner;
- import java.util.Stack;
- import java.util.StringTokenizer;
- /**
- * <b> Algorithm on Codeforces. Problem C div 2 </b> </br>
- * @author Huynh Quang Thao
- *
- */
- public class Main {
- public static void main(String[] args) throws Exception {
- Main main = new Main();
- main.run();
- }
- public void run() throws Exception {
- Scanner sc = null;
- PrintWriter pr = null;
- pr=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
- sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
- // sc = new Scanner(new File("input.txt"));
- long n = sc.nextLong();
- long sum = 0;
- for (int i = 0; i < n; i++) {
- sum += sc.nextLong();
- }
- if (sum % (n-1) == 0) System.out.println(sum / (n-1));
- else System.out.println(sum / (n-1) + 1);
- pr.close();
- sc.close();
- }
- static class Team {
- int baloon;
- int rA;
- int rB;
- public Team(int baloon, int rA, int rB) {
- this.baloon = baloon;
- this.rA = rA;
- this.rB = rB;
- }
- }
- static class InputReader {
- public BufferedReader reader;
- public StringTokenizer tokenizer;
- public InputReader(InputStream stream) {
- reader = new BufferedReader(new InputStreamReader(stream));
- tokenizer = null;
- }
- public String next() {
- while (tokenizer == null || !tokenizer.hasMoreTokens()) {
- try {
- tokenizer = new StringTokenizer(reader.readLine());
- }
- catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- return tokenizer.nextToken();
- }
- public int nextInt() {
- return Integer.parseInt(next());
- }
- public double nextDouble() {
- return Double.parseDouble(next());
- }
- public float nextFloat() {
- return Float.parseFloat(next());
- }
- public long nextLong() {
- return Long.parseLong(next());
- }
- public BigInteger nextBigInteger() {
- return new BigInteger(next());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment