返回列表 發帖
  1. import java.util.Scanner;
  2. public class Ch01 {
  3.         public static void main(String[] args){
  4.                 Scanner s=new Scanner (System.in);
  5.                 Double x,y;
  6.                 String a=s.next();
  7.                 String b=s.next();
  8.                 x=Double.parseDouble(a);
  9.                 y=Double.parseDouble(b);
  10.                 try{
  11.                         if(x==0&&y==0){
  12.                                 System.out.print("("+x+","+y+")"+"origin");
  13.                         }else if(x!=0&&y==0){
  14.                                 System.out.print("("+x+","+y+")"+"X");
  15.                         }else if(x==0&&y!=0){
  16.                                 System.out.print("("+x+","+y+")"+"Y");
  17.                         }else if(x>0&&y>0){
  18.                                 System.out.print("("+x+","+y+")"+"1");
  19.                         }else if(x<0&&y>0){
  20.                                 System.out.print("("+x+","+y+")"+"2");
  21.                         }else if(x<0&&y<0){
  22.                                 System.out.print("("+x+","+y+")"+"3");
  23.                         }else if(x>0&&y<0){
  24.                                 System.out.print("("+x+","+y+")"+"4");
  25.                         }     
  26.                
  27.                 }catch(Exception e){
  28.                         System.out.println("error");
  29.         }
  30. }
  31. }
複製代碼

TOP

返回列表