posts - 2,comments - 1,trackbacks - 0
import java.io.*;
import java.util.
*;

class Point{
    
int x;
    
int y;
    
    
public Point( int x, int y ){
        
this.x = x;
        
this.y = y;
    }
    
public void print(){
        System.
out.println( "" + x + " " + y );
    }
}

public class Main{
    
public static void main( String [] args )throws Exception{
        
        Scanner cin 
= new Scanner( System.in );
        
        
int n = cin.nextInt();
        
        PriorityQueue queue 
= new PriorityQueue<Point>1new Comparator<Point>(){
            
public int compare( Point a, Point b ){
                
if( a.x < b.x || a.x == b.x && a.y < b.y ){
                    
return -1;
                }
                
else if( a.x == b.x && a.y == b.y ){
                    
return 0;
                }
                
else{
                    
return 1;
                }
            }
        });
        
        
forint i = 0; i < n; i++ ){
            
int x = cin.nextInt();
            
int y = cin.nextInt();
            
            Point p 
= new Point( x, y );
            
            queue.add( p );
        }
        
        
while( queue.size() > 0 ){
            Point p 
= ( Point )queue.poll();
            
            p.print();
        }
    }
}

posted on 2009-08-22 21:53 Huicpc217 阅读(680) 评论(0)  编辑 收藏 引用 所属分类: JAVA模板

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理