Poj Solution 3751

http://poj.org/problem?id=3751

import java.io.BufferedInputStream;   
import java.text.ParseException;   
import java.text.SimpleDateFormat;   
import java.util.Locale;   
import java.util.Scanner;   
import java.util.logging.Level;   
import java.util.logging.Logger;   
  
/*  
 * To change this template, choose Tools | Templates  
 * and open the template in the editor.  
 */  
/**  
 *  
 * poj3751 easy  
 *  
 * API���  
 * ��ĸ  ���ڻ�ʱ��Ԫ��  ��ʾ  ʾ��  
 *G  Era ��־��  Text  AD  
 *y  ��  Year  1996; 96  
 *M  ���е��·�  Month  July; Jul; 07  
 *w  �������  Number  27  
 *W  �·��е�����  Number  2  
 *D  �������  Number  189  
 *d  �·��е�����  Number  10  
 *F  �·��е�����  Number  2  
 *E  ���������  Text  Tuesday; Tue  
 *a  Am/pm ���  Text  PM  
 *H  һ���е�Сʱ��0-23��  Number  0  
 *k  һ���е�Сʱ��1-24��  Number  24  
 *K  am/pm �е�Сʱ��0-11��  Number  0  
 *h  am/pm �е�Сʱ��1-12��  Number  12  
 *m  Сʱ�еķ�����  Number  30  
 *s  ���������  Number  55  
 *S  ������  Number  978  
 *z  ʱ��  General time zone  Pacific Standard Time; PST; GMT-08:00  
 *Z  ʱ��  RFC 822 time zone  -0800  
 * @author NC  
 */  
public class Main {   
  
    public static void main(String[] args) {   
        Scanner scanner = new Scanner(new BufferedInputStream(System.in));   
        int n = Integer.parseInt(scanner.nextLine());   
        //DateFormat ��һ�������4��   
        SimpleDateFormat df1 =   
                new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss", Locale.US);   
        //��ʮ��Сʱ��   
        SimpleDateFormat df2 =   
                new SimpleDateFormat("MM/dd/yyyy-hh:mm:ssa", Locale.US);   
        //ʮ��Сʱ�ƣ�12��01�賿��ʮ�����   
        //ϵͳĬ������������磬����am��pm   
        for (int i = 0; i < n; i++) {   
            try {   
                String s = scanner.nextLine();   
                //�Ȱ��ַ����Ϊ���ڣ��ٸ�ʽ�����ڣ�ת���ַ������תСд   
                System.out.println(df2.format(df1.parse(s)).toLowerCase());   
            } catch (ParseException ex) {   
                  
            }   
        }   
    }   
}  

											
This entry was posted in poj. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *