Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:渣代码……能AC就算了,烦死了,用JAVA的你,是不是很忧伤,很孤独。JAVA进。

Posted by kyogre at 2017-09-03 22:56:25 on Problem 1008
In Reply To:Re:渣代码……能AC就算了,烦死了,用JAVA的你,是不是很忧伤,很孤独。JAVA进。 Posted by:kyogre at 2017-09-03 22:54:57
太长了吧
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        String[] monthName = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu"};
        String[] dayName = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
        Scanner in = new Scanner(System.in);
        int col = Integer.parseInt(in.nextLine());
        String[] result = new String[col];
        for(int i = 0; i < col; i ++){
            String[] ss = in.nextLine().split(" ");
            int day = Integer.parseInt(ss[0].substring(0, ss[0].length()-1));
            String month = ss[1];
            int year = Integer.parseInt(ss[2]);
            int allDay=0,j=0;
            for(j = 0; j < monthName.length; j++){
                if(month.equals(monthName[j])){
                    break;
                }
            }
            allDay = year*365+j*20+day;
            result[i] = (allDay%260%13+1)+" "+dayName[allDay%260%20]+" "+(allDay/260);
        }
        System.out.println(col);
        for(String s: result){
            System.out.println(s);
        }
    }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator