コード例 #1
0
ファイル: E4.java プロジェクト: hiroshi-cl/wakaba
  void run() {
    Scanner sc = new Scanner(System.in);
    int oo = sc.nextInt();
    for (int o = 1; o <= oo; o++) {
      que = new PriorityQueue<E>();
      int n = sc.nextInt();
      tank = new Tank();
      count = 0;
      int[] h = new int[n + 3], b = new int[n + 3];
      h[0] = 100;
      b[0] = 0;
      h[n + 1] = 50;
      b[n + 1] = 100;
      h[n + 2] = 50;
      b[n + 2] = INF;
      for (int i = 1; i <= n; i++) {
        b[i] = sc.nextInt();
        h[i] = sc.nextInt();
      }
      n += 3;
      for (int i = 1; i < n; i++) {
        tank.bs.add(new Box(b[i - 1], b[i], h[i - 1], h[i], 0, 0));
      }
      int m = sc.nextInt();
      for (int i = 0; i < m; i++) {
        int f = sc.nextInt();
        double a = sc.nextDouble() / 30;
        for (Box box : tank.bs) {
          if (box.b1 < f && f < box.b2) box.f += a;
        }
      }
      debug(tank.bs);

      int l = sc.nextInt();
      res = new double[l];
      for (int i = 0; i < l; i++) {
        que.offer(new W(sc.nextInt(), sc.nextDouble(), i));
      }
      que.offer(tank.nextEvent());
      debug(que.size());
      while (!que.isEmpty()) {
        if (res[0] < 0) System.exit(1);
        que.poll().go();
        debug(que.peek().time());
        debug(tank.bs);
        debug(res);
        debug();
        if (count == l) break;
      }
      for (double r : res) {
        System.out.println(r);
      }
    }
  }
コード例 #2
0
ファイル: poj1269_Main.java プロジェクト: were/progs
 void run() {
   System.out.println("INTERSECTING LINES OUTPUT");
   for (N = input.nextInt(); N != 0; --N) {
     P p[] = new P[4];
     for (int i = 0; i < 4; ++i) {
       double x = input.nextDouble();
       double y = input.nextDouble();
       p[i] = new P(x, y);
     }
     P ans = isLL(p[0], p[1], p[2], p[3]);
     if (ans != null) {
       System.out.printf("POINT %.2f %.2f", ans.x, ans.y);
       System.out.println();
     } else {
       System.out.println(oneLine(p) ? "LINE" : "NONE");
     }
   }
   System.out.println("END OF OUTPUT");
 }