Guest User

Untitled

a guest
Jan 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.51 KB | None | 0 0
  1. import java.awt.Point;
  2. import java.io.*;
  3. import java.math.BigInteger;
  4. import java.security.KeyStore.Builder;
  5. import java.util.*;
  6.  
  7. import static java.lang.Math.*;
  8.  
  9. public class Testt {
  10.  
  11.     final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
  12.     BufferedReader in;
  13.     PrintWriter out;
  14.     StringTokenizer tok = new StringTokenizer("");
  15.  
  16.     void init() throws FileNotFoundException {
  17.         if (ONLINE_JUDGE) {
  18.             in = new BufferedReader(new InputStreamReader(System.in));
  19.             out = new PrintWriter(System.out);
  20.         } else {
  21.             in = new BufferedReader(new FileReader("input.txt"));
  22.             out = new PrintWriter("output.txt");
  23.         }
  24.     }
  25.  
  26.     String readString() throws IOException {
  27.         while (!tok.hasMoreTokens()) {
  28.             tok = new StringTokenizer(in.readLine());
  29.         }
  30.         return tok.nextToken();
  31.     }
  32.  
  33.     int readInt() throws IOException {
  34.         return Integer.parseInt(readString());
  35.     }
  36.  
  37.     long readLong() throws IOException {
  38.         return Long.parseLong(readString());
  39.     }
  40.  
  41.     double readDouble() throws IOException {
  42.         return Double.parseDouble(readString());
  43.     }
  44.  
  45.     public static void main(String[] args) {
  46.         new Testt().run();
  47.     }
  48.  
  49.     public void run() {
  50.         try {
  51.             long t1 = System.currentTimeMillis();
  52.             init();
  53.             solve();
  54.             out.close();
  55.             long t2 = System.currentTimeMillis();
  56.             System.err.println("Time = " + (t2 - t1));
  57.         } catch (Exception e) {
  58.             e.printStackTrace(System.err);
  59.             System.exit(-1);
  60.         }
  61.     }
  62.  
  63.     // solve! good luck :)
  64.     ArrayList<Integer> graph[];
  65.     boolean [] used;
  66.     int n;
  67.     HashMap<String, Integer> map;
  68.     HashMap<Integer, String> map2;
  69.     ArrayList<Integer> ans;
  70.     public void solve() throws IOException {
  71.  
  72.         int n = readInt();
  73.         int[][] a = new int[n][n];
  74.         for (int i = 0; i < n; i++) {
  75.             for (int j = i+1; j < n; j++) {
  76.                 a[i][j] = readInt();
  77.             }
  78.         }
  79.         int sum=0;
  80.         int maxi=0;
  81.         for (int t = 1; t < n; t++)
  82.         {  
  83.             sum=0;
  84.             for (int i = 0; i< t; i++)
  85.             {
  86.                 for (int j = t; j < n; j++) sum+=a[i][j];
  87.             }
  88.             maxi = max(maxi,sum);
  89.         }
  90.     //  out.print(maxi);
  91.         int[][] b = new int[n][n];
  92.         for (int i = 0; i < n; i++) {
  93.             for (int j = i+1; j < n; j++) {
  94.                 b[j][i] = readInt();
  95.             }
  96.         }
  97.         int maxi2=0;
  98.         for (int t = 1; t < n; t++)
  99.         {  
  100.             sum=0;
  101.             for (int i = 0; i< t; i++)
  102.             {
  103.                 for (int j = t; j < n; j++) sum+=a[j][i];
  104.             }
  105.             maxi2  = max(maxi2,sum);
  106.         }
  107.         int ans = max(maxi,maxi2);
  108.         if (ans % 36 != 0) {
  109.             ans/=36;
  110.             ans++;
  111.         }
  112.         else ans/=36;
  113.         out.print(ans);
  114.     }
  115. }
Add Comment
Please, Sign In to add comment