Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Point;
- import java.io.*;
- import java.math.BigInteger;
- import java.security.KeyStore.Builder;
- import java.util.*;
- import static java.lang.Math.*;
- public class Testt {
- final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
- BufferedReader in;
- PrintWriter out;
- StringTokenizer tok = new StringTokenizer("");
- void init() throws FileNotFoundException {
- if (ONLINE_JUDGE) {
- in = new BufferedReader(new InputStreamReader(System.in));
- out = new PrintWriter(System.out);
- } else {
- in = new BufferedReader(new FileReader("input.txt"));
- out = new PrintWriter("output.txt");
- }
- }
- String readString() throws IOException {
- while (!tok.hasMoreTokens()) {
- tok = new StringTokenizer(in.readLine());
- }
- return tok.nextToken();
- }
- int readInt() throws IOException {
- return Integer.parseInt(readString());
- }
- long readLong() throws IOException {
- return Long.parseLong(readString());
- }
- double readDouble() throws IOException {
- return Double.parseDouble(readString());
- }
- public static void main(String[] args) {
- new Testt().run();
- }
- public void run() {
- try {
- long t1 = System.currentTimeMillis();
- init();
- solve();
- out.close();
- long t2 = System.currentTimeMillis();
- System.err.println("Time = " + (t2 - t1));
- } catch (Exception e) {
- e.printStackTrace(System.err);
- System.exit(-1);
- }
- }
- // solve! good luck :)
- ArrayList<Integer> graph[];
- boolean [] used;
- int n;
- HashMap<String, Integer> map;
- HashMap<Integer, String> map2;
- ArrayList<Integer> ans;
- public void solve() throws IOException {
- int n = readInt();
- int[][] a = new int[n][n];
- for (int i = 0; i < n; i++) {
- for (int j = i+1; j < n; j++) {
- a[i][j] = readInt();
- }
- }
- int sum=0;
- int maxi=0;
- for (int t = 1; t < n; t++)
- {
- sum=0;
- for (int i = 0; i< t; i++)
- {
- for (int j = t; j < n; j++) sum+=a[i][j];
- }
- maxi = max(maxi,sum);
- }
- // out.print(maxi);
- int[][] b = new int[n][n];
- for (int i = 0; i < n; i++) {
- for (int j = i+1; j < n; j++) {
- b[j][i] = readInt();
- }
- }
- int maxi2=0;
- for (int t = 1; t < n; t++)
- {
- sum=0;
- for (int i = 0; i< t; i++)
- {
- for (int j = t; j < n; j++) sum+=a[j][i];
- }
- maxi2 = max(maxi2,sum);
- }
- int ans = max(maxi,maxi2);
- if (ans % 36 != 0) {
- ans/=36;
- ans++;
- }
- else ans/=36;
- out.print(ans);
- }
- }
Add Comment
Please, Sign In to add comment