zoukankan      html  css  js  c++  java
  • URAL 1944 大水题模拟

    D - Record of the Attack at the Orbit
    Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u

    Description

    The long-range laser at the board of combat spaceship “Rickenbacker” had successfully destroyed all the launching pads on the surface of enemy planet Orkut. Within less than a day, race Shodan had surrendered.
    The captain of “Rickenbacker” expected a promotion. His enviers, in their turn, were trying to persuade the high command that the captain was a liar—no one is able to be so quick on the uptake and to strike so many targets during an attack at the orbit. The captain understood that he was to defend his honour and prepare a detailed report on the mission accomplished. For a start, he decided to draw all the destroyed pads on one graph.
    The laser direction system is bound to a rectangular Cartesian coordinates. All the coordinates of the destroyed pads in these coordinates are integers. Axes should be depicted with symbols “|” (vertical slash, to show the y-axis), “-” (minus, to show the x-axis), “+” (plus, to show the origin). Spots where the destroyed pads were situated should be depicted with symbol “*” (asterisk). All the other points should be depicted with symbol “.” (dot). The x-axis in the graph should be directed to the right, and the y-axis should be directed upwards. One symbol in the graph corresponds to one unit on the x-axis horizontally and to one unit on the y-axis vertically. The axes should be depicted in the graph, but they may be completely covered with symbols “*”.

    Input

    The first line contains an integer n (1 ≤ n ≤ 250) that is the number of destroyed launching pads. Each of the following n lines contains coordinates of one pad. All the coordinates are integers not exceeding 100 by absolute value. No two pads are situated at the same point.

    Output

    Output the required graph. The first line should correspond to the maximum value of y (or 0), and the last one should correspond to the minimum value of y (or 0). Each line should have the same amount of symbols. The first symbol in the line should correspond to the minimum value of x (or 0) and the last one should correspond to the maximum value of x (or 0).

    Sample Input

    inputoutput
    8
    -10 5
    -7 3
    -4 2
    -9 4
    0 1
    6 -1
    3 0
    8 -3
    
    *.........|........
    .*........|........
    ...*......|........
    ......*...|........
    ..........*........
    ----------+--*-----
    ..........|.....*..
    ..........|........
    ..........|.......*
    #include<stdio.h>
    #include<string.h>
    #include<iostream>
    #include<algorithm>
    using namespace std;
    char Map[1000][1000];
    struct node{
      int x,y;
    
    }que[1000];
    bool cmp1(struct node t1,struct node t2){
    
      return t1.x<t2.x;
    }
    
    bool cmp2(struct node t1,struct node t2){
    
      return t1.y>t2.y;
    }
    
    int main(){
      int n;
      while(scanf("%d",&n)!=EOF){
    
         for(int i=0;i<=550;i++)
        for(int j=0;j<=550;j++)
        Map[i][j]='.';
    
        for(int i=0;i<=500;i++){
            Map[i][200]='-';
            Map[200][i]='|';
        }
        Map[200][200]='+';
        for(int i=0;i<n;i++){
    
            scanf("%d%d",&que[i].x,&que[i].y);
                  int tx=que[i].x+200;
                  int ty=que[i].y+200;
    
            Map[tx][ty]='*';
    
        }
        int x1,x2,y1,y2;
        sort(que,que+n,cmp1);
         x1=que[0].x+200;
           x2=que[n-1].x+200;
       sort(que,que+n,cmp2);
        y1=que[0].y+200;
         y2=que[n-1].y+200;
         if(y1>200&&y2>200)
            y2=200;
        else if(y1<200&&y2<200)
            y1=200;
         if(x1>200&&x2>200)
            x1=200;
       else  if(x1<200&&x2<200)
            x2=200;
        for(int i=y1;i>=y2;i--){
                for(int j=x1;j<=x2;j++){
               printf("%c",Map[j][i]);
                }
                printf("
    ");
            }
    
      }
      return 0;
    }
  • 相关阅读:
    X ASM 磁盘大小限制
    X Oracle 12c Non CDB 数据库 切换成 CDB 测试
    X Scalable Sequences(自适应序列)
    X RMAN新特性- RMAN duplicate PDB into existing CDB
    X Oracle Database 19c中的自动索引
    X 12c中在 RMAN 中提供了表级别恢复 RECOVER TABLE
    X 12c中对于表分区维护的增强
    CF1019C Sergey's problem
    洛谷P6140&P2870 [USACO07NOV]Best Cow Line S
    CF471D MUH and Cube Walls
  • 原文地址:https://www.cnblogs.com/13224ACMer/p/4686970.html
Copyright © 2011-2022 走看看