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

一直WA 好伤心 求高手帮忙看看

Posted by KAYY at 2019-02-12 16:41:54 on Problem 1008
#include<stdio.h>
int main()
{
	int n,a[100],c[100],days=0,mon=0,dayy=0,monn=0,yearr=0,i,j;
	char b[100][7];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d. ",&a[i]);
		for(j=0;;j++){
			scanf("%c",&b[i][j]);
			if(b[i][j]==' '){
				b[i][j]=='\0';break;
			}
		}
		scanf("%d",&c[i]);
	}
	
	
	printf("%d\n",n);
	for(i=0;i<n;i++){
		switch(b[i][0]){
			case 'p':
				if(b[i][1]=='o')
					mon=1;
				else
					mon=16;
				break;
			case 'n':mon=2;break;
			case 'z':
				if(b[i][1]=='i')
					mon=3;
				else if(b[i][1]=='o')
					mon=4;
				else
					mon=11;
				break;
			case 't':mon=5;break;
			case 'x':mon=6;break;
			case 'y':
				if(b[i][1]=='o')
					mon=7;
				else
					mon=10;
				break;
			case 'm':
				if(b[i][1]=='o')
					mon=8;
				else if(b[i][1]=='a')
					mon=13;
				else
					mon=15;
				break;
			case 'c':
				if(b[i][1]=='h')
					mon=9;
				else
					mon=18;
				break;
			case 'k':
				if(b[i][1]=='a')
					mon=14;
				else
					mon=17;
				break;
			case 'u':mon=19;break;
		}
		days=a[i]+1+(mon-1)*20+c[i]*365;
		dayy=days%13;
		monn=days%20;
		yearr=days/260;
		
		if(dayy==0)
			printf("13 ");
		else
			printf("%d ",dayy);
		
		switch(monn){
			case 1:printf("imix");break;
			case 2:printf("ik");break;
			case 3:printf("akbal");break;
			case 4:printf("kan");break;
			case 5:printf("chicchan");break;
			case 6:printf("cimi");break;
			case 7:printf("manik");break;
			case 8:printf("lamat");break;
			case 9:printf("muluk");break;
			case 10:printf("ok");break;
			case 11:printf("chuen");break;
			case 12:printf("eb");break;
			case 13:printf("ben");break;
			case 14:printf("ix");break;
			case 15:printf("mem");break;
			case 16:printf("cib");break;
			case 17:printf("caban");break;
			case 18:printf("eznab");break;
			case 19:printf("canac");break;
			case 0:printf("ahau");break;
		}
		
		if(days%260==0)
			yearr--;			
		printf(" %d\n",yearr);
	}
	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