300: Maya Calendar

Problem Link

#Solution

#include<iostream>
#include<string.h>
#include<stdio.h>
#include<map>

using namespace std;
string day[20]={“pop”,”no”,”zip”,”zotz”,”tzec”,”xul”,”yoxkin”,”mol”,”chen”,”yax”,”zac”,”ceh”,”mac”,”kankin”,”muan”,”pax”,”koyab”,”cumhu”,”uayet”};
string month[20] = {“imix”, “ik”, “akbal”, “kan”, “chicchan”, “cimi”, “manik”, “lamat”, “muluk”, “ok”, “chuen”, “eb”, “ben”, “ix”, “mem”, “cib”, “caban”, “eznab”, “canac”, “ahau”};
int main()
{
int n,d,a;
string st;
long long x=0;
cin>>n;
cout<<n<<endl;
while(n–)

{
scanf(“%d.”,&d);
cin>>st>>a;

x=0;
map<string, int> day;

day[“pop”]=0;
day[“no”]=1;
day[“zip”]=2;
day[“zotz”]=3;
day[“tzec”]=4;
day[“xul”]=5;
day[“yoxkin”]=6;
day[“mol”]=7;
day[“chen”]=8;
day[“yax”]=9;
day[“zac”]=10;
day[“ceh”]=11;
day[“mac”]=12;
day[“kankin”]=13;
day[“muan”]=14;
day[“pax”]=15;
day[“koyab”]=16;
day[“cumhu”]=17;
day[“uayet”]=18;
int f=day[st];
x=a*365+d+20*f;
cout<<(x%13)+1<<‘ ‘<<month[x%20]<<‘ ‘<<x/260<<endl;

}

return 0;
}

Advertisements

About waprogramming

I am in CSE,from CUET
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to 300: Maya Calendar

  1. Pingback: UVa Problems | Divide & Conquer (^_^)/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s