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

一次就Pass 好開心, 0ms

Posted by virusx1984 at 2014-01-21 23:28:59 on Problem 1008
// 1008_v001.c
// http://poj.org/problem?id=1008

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define INPUT_MAX 1000

int main(){
	
	int n;
	int Haab_day;
	char Haab_month[7];
	int Haab_year;
	int month_base;
	int absolute_day;
	
	char Holly_word[20][9] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
	
	int Holly_day[INPUT_MAX];
	char Holly_month[INPUT_MAX][9];
	int Holly_year[INPUT_MAX];
	int num_in = 0;
	int i;
		
	scanf("%d", &n);	
	
	while(scanf("%d. %s %d", &Haab_day, Haab_month, &Haab_year) != EOF ){
		
		if(memcmp(Haab_month, "po", 2) == 0){
			month_base = 0;
		}else if(memcmp(Haab_month, "no", 2) == 0){
			month_base = 20;
		}else if(memcmp(Haab_month, "zi", 2) == 0){
			month_base = 40;
		}else if(memcmp(Haab_month, "zo", 2) == 0){
			month_base = 60;
		}else if(memcmp(Haab_month, "tz", 2) == 0){
			month_base = 80;
		}else if(memcmp(Haab_month, "xu", 2) == 0){
			month_base = 100;
		}else if(memcmp(Haab_month, "yo", 2) == 0){
			month_base = 120;
		}else if(memcmp(Haab_month, "mo", 2) == 0){
			month_base = 140;
		}else if(memcmp(Haab_month, "ch", 2) == 0){
			month_base = 160;
		}else if(memcmp(Haab_month, "ya", 2) == 0){
			month_base = 180;
		}else if(memcmp(Haab_month, "za", 2) == 0){
			month_base = 200;
		}else if(memcmp(Haab_month, "ce", 2) == 0){
			month_base = 220;
		}else if(memcmp(Haab_month, "ma", 2) == 0){
			month_base = 240;
		}else if(memcmp(Haab_month, "ka", 2) == 0){
			month_base = 260;
		}else if(memcmp(Haab_month, "mu", 2) == 0){
			month_base = 280;
		}else if(memcmp(Haab_month, "pa", 2) == 0){
			month_base = 300;
		}else if(memcmp(Haab_month, "ko", 2) == 0){
			month_base = 320;
		}else if(memcmp(Haab_month, "cu", 2) == 0){
			month_base = 340;
		}else if(memcmp(Haab_month, "ua", 2) == 0){
			month_base = 360;
		}
		
		absolute_day = Haab_year * 365 + month_base + Haab_day;
		Holly_year[num_in] = (int)(absolute_day / (13 * 20));
		strcpy(Holly_month[num_in], Holly_word[absolute_day % 20]);
		Holly_day[num_in] = (absolute_day % 13) + 1;
		num_in++;
	}
	
	printf("%d", n);
	
	for(i = 0; i < num_in; i++){
		printf("\n%d %s %d", Holly_day[i], Holly_month[i], Holly_year[i]);
	}
	
	return 0;
}

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