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

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

Posted by dengyaolong at 2013-03-26 23:16:31 on Problem 1008
import java.util.Scanner;

public class p1008 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner cin=new Scanner(System.in);
		String b1=cin.nextLine();
		int b=Integer.parseInt(b1);
	int	countday []=new int[b];
	int countmon []=new int[b];
	int countyea []=new int[b];
	int day[]=new int[b];
	int year[]=new int [b];
	int mon[]=new int[b];
	int d[]=new int[b];
		String []TT=new String[b];
		for(int i=0;i<b;i++){
			TT[i]=cin.nextLine();
			TT[i]=TT[i].replace(" ", "");
			 TT[i]=TT[i].replace("pop", "01");
			 TT[i]=TT[i].replace("no", "02");
			 TT[i]=TT[i].replace("zip", "03");
			 TT[i]=TT[i].replace("zotz", "04");
			 TT[i]=TT[i].replace("tzec", "05");
			 TT[i]=TT[i].replace("xul", "06");
			 TT[i]=TT[i].replace("yoxkin", "07");
			 TT[i]=TT[i].replace("mol", "08");
			 TT[i]=TT[i].replace("chen", "09");
			 TT[i]=TT[i].replace("yax", "10");
			 TT[i]=TT[i].replace("zac", "11");
			 TT[i]=TT[i].replace("ceh", "12");
			 TT[i]=TT[i].replace("mac", "13");
			 TT[i]=TT[i].replace("kankin", "14");
			 TT[i]=TT[i].replace("muan", "15");
			 TT[i]=TT[i].replace("pax", "16");
			 TT[i]=TT[i].replace("koyab", "17");
			 TT[i]=TT[i].replace("cumhu", "18");
			 TT[i]=TT[i].replace("uayet", "19");
			 
			 //System.out.println(TT[i]);
			//System.out.println(10*Integer.parseInt(String.valueOf(TT[i].charAt(0)))+Integer.parseInt(String.valueOf(TT[i].charAt(1))));
			
			
		}
       for(int j=0;j<b;j++){
        	int k;
        	for(k=0;TT[j].charAt(k)!='.';k++){
        		if(k>=1){
        		countday[j]=Integer.parseInt(String.valueOf(TT[j].charAt(k)))+10*Integer.parseInt(String.valueOf(TT[j].charAt(k-1)));}
        		else{countday[j]=Integer.parseInt(String.valueOf(TT[j].charAt(k))); }
        	}
        	
        		countmon[j]= Integer.parseInt(String.valueOf(TT[j].charAt(++k)));
        		countmon[j]=Integer.parseInt(String.valueOf(TT[j].charAt(++k)))+10*countmon[j];
        		countyea[j]=Integer.parseInt(String.valueOf(TT[j].charAt(++k)));
        		for(k=k+1;k<TT[j].length();k++){
        			countyea[j]=countyea[j]*10+Integer.parseInt(String.valueOf(TT[j].charAt(k)));
        		}
        		
        	}
       System.out.println(b);
        	for(int q=0;q<b;q++){
        		/*System.out.println(countday[q]);
        		System.out.println(countmon[q]);
        		System.out.println(countyea[q]);*/
        		countday[q]=countday[q]+1;
        		if(countmon[q]>=1){
        		day[q]=countday[q]+20*(countmon[q]-1)+365*(countyea[q]);}
        	
        	else{day[q]=countday[q]+365*(countyea[q]);}
        		//System.out.println(day[q]);
        		year[q]=(day[q]-1)/260;
        		
        	
        		mon[q]=(day[q]-1)%20;
        	
        	
        	
        		
        		d[q]=(day[q]-1)%13+1;
  
        		System.out.print(d[q]);
        		if(mon[q]==0){System.out.print(" "+"imix");}
        		else if(mon[q]==1){System.out.print(" "+"ik");}
        		else if(mon[q]==2){System.out.print(" "+"akbal");}
        		else if(mon[q]==3){System.out.print(" "+"kan");}
        		else if(mon[q]==4){System.out.print(" "+"chicchan");}
        		else if(mon[q]==5){System.out.print(" "+"cimi");}
        		else if(mon[q]==6){System.out.print(" "+"manik");}
        		else if(mon[q]==7){System.out.print(" "+"lamat");}
        		else if(mon[q]==8){System.out.print(" "+"muluk");}
        		else if(mon[q]==9){System.out.print(" "+"ok");}
        		else if(mon[q]==10){System.out.print(" "+"chuen");}
        		else if(mon[q]==11){System.out.print(" "+"eb");}
        		else if(mon[q]==12){System.out.print(" "+"ben");}
        		
        		else if(mon[q]==13){System.out.print(" "+"ix");}
        		else if(mon[q]==14){System.out.print(" "+"mem");}
        		else if(mon[q]==15){System.out.print(" "+"cib");}
        		else if(mon[q]==16){System.out.print(" "+"caban");}
        		else if(mon[q]==17){System.out.print(" "+"eznab");}
        		else if(mon[q]==18){System.out.print(" "+"canac");}
        		else if(mon[q]==19){System.out.print(" "+"ahau");}
        		System.out.println(" "+year[q]);
        	}
        }
	}


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