日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > c/c++ >内容正文

c/c++

C++程序练习-1008:Maya Calendar-玛雅日历

發布時間:2023/12/18 c/c++ 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 C++程序练习-1008:Maya Calendar-玛雅日历 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

描述
During his last sabbatical, professor M. A. Ya made a surprising discovery about the old Maya calendar. From an old knotted message, professor discovered that the Maya civilization used a 365 day long year, called Haab, which had 19 months. Each of the first 18 months was 20 days long, and the names of the months were pop, no, zip, zotz, tzec, xul, yoxkin, mol, chen, yax, zac, ceh, mac, kankin, muan, pax, koyab, cumhu. Instead of having names, the days of the months were denoted by numbers starting from 0 to 19. The last month of Haab was called uayet and had 5 days denoted by numbers 0, 1, 2, 3, 4. The Maya believed that this month was unlucky, the court of justice was not in session, the trade stopped, people did not even sweep the floor.

For religious purposes, the Maya used another calendar in which the year was called Tzolkin (holly year). The year was divided into thirteen periods, each 20 days long. Each day was denoted by a pair consisting of a number and the name of the day. They used 20 names: imix, ik, akbal, kan, chicchan, cimi, manik, lamat, muluk, ok, chuen, eb, ben, ix, mem, cib, caban, eznab, canac, ahau and 13 numbers; both in cycles.

Notice that each day has an unambiguous description. For example, at the beginning of the year the days were described as follows:

1 imix, 2 ik, 3 akbal, 4 kan, 5 chicchan, 6 cimi, 7 manik, 8 lamat, 9 muluk, 10 ok, 11 chuen, 12 eb, 13 ben, 1 ix, 2 mem, 3 cib, 4 caban, 5 eznab, 6 canac, 7 ahau, and again in the next period 8 imix, 9 ik, 10 akbal . . .

Years (both Haab and Tzolkin) were denoted by numbers 0, 1, : : : , where the number 0 was the beginning of the world. Thus, the first day was:

Haab: 0. pop 0

Tzolkin: 1 imix 0
Help professor M. A. Ya and write a program for him to convert the dates from the Haab calendar to the Tzolkin calendar.

輸入
The date in Haab is given in the following format:
NumberOfTheDay. Month Year

The first line of the input file contains the number of the input dates in the file. The next n lines contain n dates in the Haab calendar format, each in separate line. The year is smaller then 5000.

輸出
The date in Tzolkin should be in the following format:
Number NameOfTheDay Year

The first line of the output file contains the number of the output dates. In the next n lines, there are dates in the Tzolkin calendar format, in the order corresponding to the input dates.

樣例輸入
3
10. zac 0
0. pop 0
10. zac 1995
樣例輸出
3
3 chuen 0
1 imix 0
9 cimi 2801

分析問題:
Haab:19個月,前18個月每個月20天,最后一個月5天,一年365天。
Tzolkin:20個名字,20天一次循環,13個數字,13天一個循環,一年260天。
2種日歷一年的第一天固定。
思路:
根據Haab算出總天數,再按照Tzolkin的條件算出年月日。
注意事項:
第一行要輸出test cases的總數

//冰非寒(binfeihan@126.com) //252kB 10ms 1906 B G++ #include <iostream> #include <string> #include <cstdio> using namespace std; //global variables const string mHaab[] = { "pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"}; const string mTzolkin[]={ "imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"}; const int N365 = 365; const int N260 = 260; const int N20 = 20; const int N19 = 19; const int N13 = 13; //class: Calendar typedef class Calendar{ public: int dayHaab; string monthHaab; int yearHaab; int dayTzolkin; string monthTzolkin; int yearTzolkin; int totalDays; void setTotalDays(); void setTzolkin(); void printTzolkin(); }Calendar; //calculate the total days void Calendar::setTotalDays(){ this->totalDays = this->yearHaab * N365; for(int i(0);i != N19;++ i){ if(this->monthHaab.compare(mHaab[i]) == 0){ this->totalDays += i * N20; break; } } this->totalDays += this->dayHaab + 1; } //set calendar of Tzolkin void Calendar::setTzolkin(){ this->setTotalDays(); this->yearTzolkin = (this->totalDays - 1)/ N260; this->totalDays %= N260; this->monthTzolkin = (this->totalDays % N20 == 0?mTzolkin[N19]:mTzolkin[this->totalDays % N20 - 1]); this->dayTzolkin = (this->totalDays % N13 == 0?N13:this->totalDays % N13); } //print calendar of Tzolkin void Calendar::printTzolkin(){ cout<<this->dayTzolkin<<' '<<this->monthTzolkin<<' '<<this->yearTzolkin<<endl; } //main function int main(){ int cases; Calendar cld; //store ',' char ch; cin>>cases; //print the number of test cases cout<<cases<<endl; while(cases --){ cin>>cld.dayHaab>>ch>>cld.monthHaab>>cld.yearHaab; cld.setTzolkin(); cld.printTzolkin(); } return 0; }

總結

以上是生活随笔為你收集整理的C++程序练习-1008:Maya Calendar-玛雅日历的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 后进极品美女白嫩翘臀 | 超碰免费公开 | 日本中文视频 | 91传媒视频在线观看 | 国产高清在线不卡 | 日本一区二区三区精品视频 | 成人在线激情网 | 国产午夜精品理论片 | 日本黄区免费视频观看 | 东北老女人av | www.久久综合 | 国产精品美女久久久久久久 | 网友自拍咪咪爱 | 中文字幕一区二区在线播放 | 网友自拍视频 | 国模私拍一区二区 | 精品一区二区久久久久久按摩 | 日韩男人天堂 | 黑丝一区二区三区 | 亚洲免费中文 | 日本一级理论片在线大全 | 久热久操 | av一级在线观看 | 相亲对象是问题学生动漫免费观看 | 狼人精品一区二区三区在线 | 麻豆changesxxx国产 | 香蕉网址 | 久久久国产精品黄毛片 | 毛片最新网址 | 欧美性生活在线视频 | 男男黄网站 | 日本免费不卡一区二区 | 日韩高清二区 | 日日网站 | 99久久精品国产一区二区成人 | 青娱乐国产盛宴 | 国产福利视频一区二区三区 | 亚洲精品乱码久久久久久不卡 | 在线a毛片 | 国产内射老熟女aaaa∵ | 国产91大片 | 妹子干综合网 | jizz日本视频 | www.99re7.com| 国产精品无码专区av在线播放 | 男人和女人做爽爽视频 | 字幕网在线观看 | 性猛交xxxx乱大交3 | 国产精品人人妻人人爽 | 久久婷婷av| 国产人澡人澡澡澡人碰视频 | 久久久久久av无码免费网站 | 激情伦成人综合小说 | 欧洲女性下面有没有毛发 | 婷婷深爱激情 | 97色在线观看| 狠狠干b| 国内外成人免费视频 | 久久aⅴ国产欧美74aaa | 一本大道久久久久精品嫩草 | 奇米第四色在线 | 亚洲国产精品视频一区 | 国产真实交换夫妇视频 | 欧美亚洲精品天堂 | 国产精品日日摸天天碰 | 天堂视频在线观看免费 | 91草视频| 综合色爱 | 久久人妻少妇嫩草av无码专区 | 色吧综合网 | 国产精品男女视频 | 偷拍欧美另类 | 精品一区二区三区成人免费视频 | 欧美日韩国产免费 | 国产粉嫩在线 | 91av免费在线观看 | 99久久综合网 | 黄色成人毛片 | 欧美在线一卡 | 成人免费性视频 | 黑人添美女bbb添高潮了 | 奴色虐av一区二区三区 | 2020av视频 | 黄瓜视频在线播放 | 污污的网站在线免费观看 | 国产精品久久二区 | 天天天色 | 潘甜甜在线 | 91av在线免费 | 欧美作爱视频 | 精品久久久久一区二区国产 | 婷婷在线免费 | 色婷婷视频网 | 穿情趣内衣被c到高潮视频 欧美性猛交xxxx黑人猛交 | 天天插天天狠 | 日韩在线观看视频免费 | 日韩无码精品一区二区 | 亚洲二区在线视频 | 熟妇女人妻丰满少妇中文字幕 |