#include <string.h>
#include <stdio.h>
#include <Windows.h>
#include <string.h>
#include "StdAfx.h"
#define days1800  341
int nongli[]=
{
    /*************************************** 
    * 农历1800-2100年大月小月与闰月 * 
    * (连同111个闰月在内共3723个月) * 
    * 公元1800-01-01为腊月(大)初七 * 
    * 公元1800-01-25为农历正月初一 * 
    ***************************************/ 
    1,0,1,1,0,1,0,1,0,1,0,1,0, //1800闰四月小 
    0,1,1,0,1,0,1,1,0,1,0,1, 
    0,0,1,0,1,0,1,1,1,0,1,0, 
    1,0,0,1,0,1,0,1,1,0,1,1,0, //1803闰二月小 
    1,0,0,1,0,0,1,1,0,1,1,1, 
    0,1,0,1,0,0,0,1,0,1,1,1,0, //1805闰六月小 
    1,1,0,1,0,0,0,1,0,1,1,0, 
    1,1,1,0,0,1,0,0,1,0,1,1, 
    0,1,1,0,1,0,1,0,1,0,0,1,0, //1808闰五月小 
    1,1,0,1,1,0,1,0,1,0,0,1, 
    0,1,0,1,1,0,1,1,0,1,0,1, 
    0,0,1,0,1,0,1,1,0,1,1,0,1, //1811闰三月小 
    0,0,1,0,1,0,1,0,1,1,1,0, 
    1,0,1,0,0,0,1,0,1,1,1,0, 
    1,1,0,1,0,0,0,1,0,1,1,0,1, //1814闰二月小 
    1,1,0,0,1,0,0,1,0,1,0,1, 
    1,1,0,1,0,1,0,0,1,0,1,0,1, //1816闰六月小 
    1,0,1,1,0,1,0,1,0,0,1,0, 
    1,0,1,1,0,1,1,0,1,0,0,1, 
    0,1,0,1,0,1,1,0,1,1,0,1,0, //1819闰四月小 
    0,1,0,1,0,1,0,1,1,1,0,1, 
    0,0,1,0,0,1,0,1,1,1,0,1, 
    1,0,1,0,0,0,1,0,1,1,0,1,1, //1822闰三月小 
    1,0,1,0,0,0,1,0,1,0,1,1, 
    1,0,1,0,1,0,0,1,0,1,0,1,1, //1824闰七月大 
    1,0,1,0,1,0,0,1,0,1,0,1, 
    1,0,1,1,0,1,0,0,1,0,1,0, 
    1,0,1,1,0,1,0,1,0,1,0,1,0, //1827闰五月大 
    1,0,1,0,1,1,0,1,0,1,0,1, 
    0,1,0,1,0,1,0,1,1,0,1,1, 
    0,0,1,0,0,1,0,1,1,0,1,1,1, //1830闰四月小 
    0,0,1,0,0,1,0,1,0,1,1,1, 
    0,1,0,1,0,0,1,0,1,0,1,1,1, //1832闰九月小 
    0,1,0,1,0,0,1,0,1,0,1,1, 
    0,1,1,0,1,0,0,1,0,1,0,1, 
    0,1,1,0,1,1,0,0,1,0,1,0,1, //1835闰六月小 
    0,1,0,1,1,0,1,0,1,0,1,0, 
    1,0,1,0,1,0,1,1,0,1,0,1, 
    0,1,0,1,0,0,1,1,0,1,1,0,1, //1838闰四月小 
    0,1,0,0,1,0,1,0,1,1,1,0, 
    1,0,1,0,0,1,0,1,0,1,1,1, 
    0,1,0,1,0,0,1,0,1,0,1,0,1, //1841闰三月大 
    1,1,0,1,0,0,1,0,1,0,1,0, 
    1,1,1,0,1,0,0,1,0,1,0,1,0, //1843闰七月大 
    1,1,0,1,0,1,0,1,0,1,0,1, 
    0,1,0,1,1,0,1,0,1,0,1,0, 
    1,0,1,0,1,0,1,0,1,1,0,1,0, //1846闰五月小 
    1,0,0,1,0,1,0,1,1,1,0,1, 
    0,1,0,0,1,0,1,0,1,1,1,0, 
    1,0,1,0,0,1,0,1,0,1,0,1,1, //1849闰四月小 
    1,0,1,0,0,1,0,0,1,1,0,1, 
    1,1,0,1,0,0,1,1,0,1,0,1,0, //1851闰八月小 
    1,0,1,1,0,0,1,0,1,0,0,1,  
    1,0,1,1,0,1,0,1,0,1,0,1,  
    0,1,0,1,0,1,1,0,1,0,1,0,1, //1854闰七月小 
    0,0,1,0,1,1,0,1,1,0,1,0,  
    1,0,0,1,0,1,0,1,1,1,0,1,  
    0,1,0,0,1,0,1,0,1,0,1,1,1, //1857闰五月小 
    0,1,0,0,1,0,0,1,1,0,1,1,  
    1,0,1,0,0,1,0,0,1,0,1,1,  
    1,0,1,1,0,0,1,0,0,1,0,1,1, //1860闰三月大 
    0,1,1,0,1,0,1,0,1,0,0,1,  
    1,0,1,0,1,1,0,1,0,1,0,0,1, //1862闰八月小 
    0,1,1,0,1,0,1,1,0,1,0,1,  
    0,0,1,0,1,0,1,1,0,1,1,0,  
    1,0,0,1,0,1,0,1,1,0,1,1,0, //1865闰五月大 
    1,0,0,1,0,0,1,1,0,1,1,1, 
    0,1,0,0,1,0,0,1,0,1,1,1,  
    0,1,1,0,0,1,0,0,1,0,1,1,0, //1868闰四月小,以下"原为"取自<人生必备万年历> 
    1,1,1,0,0,1,0,0,1,0,1,0,  
    1,1,1,0,1,0,1,0,0,1,0,1,0, //1870闰十月小,原为1,1,1,0,1,0,1,0,0,1,0,1,1, 
    1,1,0,1,1,0,1,0,1,0,0,1,   // 原为0,1,0,1,1,0,1,0,1,0,0,1, 
    0,1,0,1,1,0,1,0,1,1,0,1, 
    0,0,1,0,1,0,1,1,0,1,1,0,1, //1873闰六月大,原为0,0,1,0,1,1,1,0,0,1,1,0,1, 
    0,0,1,0,1,0,1,0,1,1,1,0, 
    1,0,0,1,0,0,1,0,1,1,1,0,  
    1,1,0,0,1,0,0,1,0,1,1,0,1, //1876闰五月小 
    1,1,0,0,1,0,0,1,0,1,0,1,   // 原为1,1,0,0,1,0,1,0,0,1,0,1, 
    1,1,0,1,0,1,0,0,1,0,1,0,  
    1,1,0,1,1,0,1,0,0,1,0,1,0, //1879闰三月大,原为1,1,1,1,0,0,1,0,0,1,0,1,0, 
    1,0,1,1,0,1,1,0,1,0,0,1,  
    0,1,0,1,0,1,1,0,1,1,0,1,0, //1881闰七月小 
    0,1,0,1,0,1,0,1,1,0,1,1,  
    0,0,1,0,0,1,0,1,1,1,0,1,  
    1,0,0,1,0,0,1,0,1,1,0,1,1, //1884闰五月小,原为1,0,0,1,1,0,0,0,1,1,0,1,1, 
    1,0,0,1,0,0,1,0,1,0,1,1,  
    1,0,1,0,1,0,0,1,0,1,0,1,  
    1,1,0,1,0,1,0,0,1,0,1,0,1, //1887闰四月小 
    1,0,1,1,0,1,0,0,1,0,1,0,  
    1,0,1,1,0,1,0,1,0,1,0,1,  
    0,1,0,1,0,1,0,1,1,0,1,0,1, //1890闰二月小,原为0,1,0,1,0,1,1,0,1,0,1,0,1, 
    0,1,0,1,0,1,0,1,1,0,1,1,  
    0,0,1,0,0,1,0,1,1,0,1,1,1, //1892闰六月小 
    0,0,1,0,0,1,0,1,0,1,1,1,  
    0,1,0,1,0,0,1,0,1,0,1,1,  
    1,0,1,0,1,0,0,1,0,1,0,1,0, //1895闰五月小 
    1,1,1,0,1,0,0,1,0,1,0,1,   // 原为1,1,1,0,1,0,1,0,0,1,0,1, 
    0,1,1,0,1,0,1,0,1,0,1,0,  
    1,0,1,0,1,1,0,1,0,1,0,1,0, //1898闰三月小 
    1,0,1,0,1,0,1,1,0,1,0,1,  
    0,1,0,0,1,0,1,1,0,1,1,0,1, //1900闰八月小 
    0,1,0,0,1,0,1,0,1,1,1,0, 
    1,0,1,0,0,1,0,1,0,1,1,1,  
    0,1,0,1,0,0,1,0,0,1,1,0,1, //1903闰五月小 
    1,1,0,1,0,0,1,0,0,1,1,0,  
    1,1,0,1,1,0,0,1,0,1,0,1,  
    0,1,1,0,1,0,1,0,1,0,1,0,1, //1906闰四月大 
    0,1,0,1,0,1,1,0,1,0,1,0,  
    1,0,0,1,1,0,1,0,1,1,0,1,  
    0,1,0,0,1,0,1,0,1,1,1,0,1, //1909闰二月小 
    0,1,0,0,1,0,1,0,1,1,1,0,  
    1,0,1,0,0,1,0,0,1,1,0,1,1, //1911闰六月小 
    1,0,1,0,0,1,0,0,1,1,0,1,  
    1,1,0,1,0,0,1,0,0,1,0,1,  
    1,1,0,1,0,1,0,1,0,0,1,0,1, //1914闰五月大 
    1,0,1,1,0,1,0,1,0,1,0,0,  
    1,1,0,1,0,1,1,0,1,0,1,0,  
    1,0,0,1,0,1,1,0,1,1,0,1,0, //1917闰二月小 
    1,0,0,1,0,1,0,1,1,0,1,1,  
    0,1,0,0,1,0,0,1,1,0,1,1,1, //1919闰七月大 
    0,1,0,0,1,0,0,1,0,1,1,1,  
    1,0,1,0,0,1,0,0,1,0,1,1, 
    1,0,1,1,0,0,1,0,0,1,0,1,1, //1922闰五月小 
    0,1,1,0,1,0,1,0,0,1,0,1, 
    0,1,1,0,1,1,0,1,0,1,0,0, 
    1,0,1,0,1,1,0,1,1,0,1,0,1, //1925闰四月大 
    0,0,1,0,1,0,1,1,0,1,1,0, 
    1,0,0,1,0,1,0,1,0,1,1,1, 
    0,1,0,0,1,0,0,1,0,1,1,1,1, //1928闰二月小 
    0,1,0,0,1,0,0,1,0,1,1,1, 
    0,1,1,0,0,1,0,0,1,0,1,1,0, //1930闰六月小 
    1,1,0,1,0,1,0,0,1,0,1,0, 
    1,1,1,0,1,0,1,0,0,1,0,1, 
    0,1,1,0,1,1,0,1,0,1,0,0,1, //1933闰五月大 
    0,1,0,1,1,0,1,0,1,1,0,1, 
    0,0,1,0,1,0,1,1,0,1,1,0, 
    1,0,0,1,0,0,1,1,0,1,1,1,0, //1936闰三月大 
    1,0,0,1,0,0,1,0,1,1,1,0, 
    1,1,0,0,1,0,0,1,0,1,1,0,1, //1938闰七月大 
    1,1,0,0,1,0,0,1,0,1,0,1, 
    1,1,0,1,0,1,0,0,1,0,1,0, 
    1,1,0,1,1,0,1,0,0,1,0,1,0, //1941闰六月大 
    1,0,1,1,0,1,0,1,0,1,0,1, 
    0,1,0,1,0,1,1,0,1,0,1,0, 
    1,0,1,0,1,0,1,0,1,1,0,1,1, //1944闰四月大 
    0,0,1,0,0,1,0,1,1,1,0,1, 
    1,0,0,1,0,0,1,0,1,1,0,1, 
    1,1,0,0,1,0,0,1,0,1,0,1,1, //1947闰二月小 
    1,0,1,0,1,0,0,1,0,1,0,1, 
    1,0,1,1,0,1,0,0,1,0,1,0,1, //1949闰七月小 
    0,1,1,0,1,1,0,0,1,0,1,0, 
    1,0,1,1,0,1,0,1,0,1,0,1, 
    0,1,0,1,0,1,0,1,1,0,1,0,1, //1952闰五月大 
    0,1,0,0,1,1,0,1,1,0,1,0, 
    1,0,1,0,0,1,0,1,1,0,1,1, 
    0,1,0,1,0,0,1,0,1,0,1,1,1, //1955闰三月大 
    0,1,0,1,0,0,1,0,1,0,1,1, 
    1,0,1,0,1,0,0,1,0,1,0,1,0, //1957闰八月小 
    1,1,1,0,1,0,0,1,0,1,0,1, 
    0,1,1,0,1,0,1,0,1,0,1,0, 
    1,0,1,0,1,1,0,1,0,1,0,1,0, //1960闰六月小 
    1,0,1,0,1,0,1,1,0,1,0,1, 
    0,1,0,0,1,0,1,1,0,1,1,0, 
    1,0,1,0,0,1,0,1,0,1,1,1,0, //1963闰四月小 
    1,0,1,0,0,1,0,1,0,1,1,1, 
    0,1,0,1,0,0,1,0,0,1,1,0, 
    1,1,1,0,1,0,0,1,0,0,1,1,0, //1966闰三月小 
    1,1,0,1,1,0,0,1,0,1,0,1, 
    0,1,0,1,1,0,1,0,1,0,1,0,1, //1968闰七月小 
    0,1,0,1,0,1,1,0,1,0,1,0, 
    1,0,0,1,0,1,1,0,1,1,0,1, 
    0,1,0,0,1,0,1,0,1,1,1,0,1, //1971闰五月小 
    0,1,0,0,1,0,1,0,1,1,0,1, 
    1,0,1,0,0,1,0,0,1,1,0,1, 
    1,1,0,1,0,0,1,0,0,1,1,0,1, //1974闰四月小 
    1,1,0,1,0,0,1,0,0,1,0,1, 
    1,1,0,1,0,1,0,1,0,0,1,0,1, //1976闰八月小 
    1,0,1,1,0,1,0,1,0,1,0,0, 
    1,0,1,1,0,1,1,0,1,0,1,0, 
    1,0,0,1,0,1,1,0,1,1,0,1,0, //1979闰六月大 
    1,0,0,1,0,1,0,1,1,0,1,1, 
    0,1,0,0,1,0,0,1,1,0,1,1, 
    1,0,1,0,0,1,0,0,1,0,1,1,1, //1982闰四月小 
    1,0,1,0,0,1,0,0,1,0,1,1, 
    1,0,1,1,0,0,1,0,0,1,0,1,1, //1984闰十月小 
    0,1,1,0,1,0,1,0,0,1,0,1, 
    0,1,1,0,1,1,0,1,0,1,0,0, 
    1,0,1,0,1,1,0,1,1,0,1,0,0, //1987闰六月小 
    1,0,1,0,1,0,1,1,0,1,1,0, 
    1,0,0,1,0,1,0,1,0,1,1,1, 
    0,1,0,0,1,0,0,1,0,1,1,1,1, //1990闰五月小 
    0,1,0,0,1,0,0,1,0,1,1,1, 
    0,1,1,0,0,1,0,0,1,0,1,1, 
    0,1,1,0,1,0,1,0,0,1,0,1,0, //1993闰三月小 
    1,1,1,0,1,0,1,0,0,1,0,1, 
    0,1,1,0,1,0,1,1,0,0,1,0,1, //1995闰八月小 
    0,1,0,1,1,0,1,0,1,1,0,0, 
    1,0,1,0,1,0,1,1,0,1,1,0, 
    1,0,0,1,0,0,1,1,0,1,1,0,1, //1998闰五月小 
    1,0,0,1,0,0,1,0,1,1,1,0, 
    1,1,0,0,1,0,0,1,0,1,1,0, 
    1,1,0,1,0,1,0,0,1,0,1,0,1, //2001闰四月小 
    1,1,0,1,0,1,0,0,1,0,1,0, 
    1,1,0,1,1,0,1,0,0,1,0,1, 
    0,1,0,1,1,0,1,0,1,0,1,0,1, //2004闰二月小 
    0,1,0,1,0,1,1,0,1,0,1,0, 
    1,0,1,0,1,0,1,0,1,1,0,1,1, //2006闰七月小 
    0,0,1,0,0,1,0,1,1,1,0,1, 
    1,0,0,1,0,0,1,0,1,1,0,1, 
    1,1,0,0,1,0,0,1,0,1,0,1,1, //2009闰五月小 
    1,0,1,0,1,0,0,1,0,1,0,1, 
    1,0,1,1,0,1,0,0,1,0,1,0,  
    1,0,1,1,0,1,0,1,0,1,0,1,0, //2012闰四月小 
    1,0,1,0,1,1,0,1,0,1,0,1,  
    0,1,0,1,0,1,0,1,1,0,1,0,1, //2014闰九月小 
    0,1,0,0,1,0,1,1,1,0,1,0,  
    1,0,1,0,0,1,0,1,1,0,1,1,  
    0,1,0,1,0,0,1,0,1,0,1,1,1, //2017闰六月大 
    0,1,0,1,0,0,1,0,1,0,1,1,  
    1,0,1,0,1,0,0,1,0,0,1,1,  
    0,1,1,1,0,1,0,0,1,0,1,0,1, //2020闰四月小 
    0,1,1,0,1,0,1,0,1,0,1,0,  
    1,0,1,0,1,1,0,1,0,1,0,1,  
    0,1,0,0,1,1,0,1,1,0,1,0,1, //2023闰二月小 
    0,1,0,0,1,0,1,1,0,1,1,0,  
    1,0,1,0,0,1,0,1,0,1,1,1,0, //2025闰六月小 
    1,0,1,0,0,1,0,0,1,1,1,0,  
    1,1,0,1,0,0,1,0,0,1,1,0,  
    1,1,1,0,1,0,0,1,0,0,1,1,0, //2028闰五月小 
    1,1,0,1,0,1,0,1,0,0,1,1,  
    0,1,0,1,1,0,1,0,1,0,1,0,  
    0,1,1,0,1,0,1,1,0,1,0,1,0, //2031闰三月小 
    1,0,0,1,0,1,1,0,1,1,0,1,  
    0,1,0,0,1,0,1,0,1,1,1,0,1, //2033闰冬月小 
    0,1,0,0,1,0,1,0,1,1,0,1,  
    1,0,1,0,0,1,0,0,1,1,0,1,  
    1,1,0,1,0,0,1,0,0,1,0,1,1, //2036闰六月大 
    1,1,0,1,0,0,1,0,0,1,0,1,  
    1,1,0,1,0,1,0,1,0,0,1,0,   // 原为1,1,0,1,0,1,0,1,0,1,0,0, 
    1,1,0,1,1,0,1,0,1,0,1,0,0, //2039闰五月小 
    1,0,1,1,0,1,0,1,1,0,1,0,  
    0,1,0,1,0,1,1,0,1,1,0,1,  
    0,1,0,0,1,0,1,0,1,1,0,1,1, //2042闰二月小 
    0,1,0,0,1,0,0,1,1,0,1,1,  
    1,0,1,0,0,1,0,0,1,0,1,1,1, //2044闰七月小 
    1,0,1,0,0,1,0,0,1,0,1,1,  
    1,0,1,0,1,0,1,0,0,1,0,1,  
    1,0,1,1,0,1,0,1,0,0,1,0,1, //2047闰五月大 
    0,1,1,0,1,1,0,1,0,0,1,0,  
    1,0,1,0,1,1,0,1,1,0,1,0,  
    0,1,0,1,0,1,0,1,1,0,1,1,0, //2050闰三月大 
    1,0,0,1,0,0,1,1,0,1,1,1,  
    0,1,0,0,1,0,0,1,0,1,1,1,1, //2052闰八月小 
    0,1,0,0,1,0,0,1,0,1,1,1,  
    0,1,1,0,0,1,0,0,1,0,1,1,  
    0,1,1,0,1,0,1,0,0,1,0,1,0, //2055闰六月大 
    1,1,1,0,1,0,1,0,0,1,0,1,  
    0,1,1,0,1,0,1,0,1,0,1,0, // 原为0,1,1,0,1,0,1,1,0,0,1,0, 
    1,0,1,0,1,0,1,1,0,1,1,0,0, //2058闰四月大 
    1,0,1,0,1,0,1,0,1,1,1,0,  
    1,0,0,1,0,0,1,0,1,1,1,0, 
    1,1,0,0,1,0,0,1,0,1,1,1,0, //农历2061年闰三月小 
    1,1,0,0,1,0,0,1,0,1,1,0, 
    1,1,0,1,0,1,0,0,1,0,1,0,1, //农历2063年闰七月小 
    1,1,0,1,0,1,0,0,1,0,1,0, 
    1,1,0,1,1,0,1,0,0,1,0,1, 
    0,1,0,1,1,0,1,0,1,0,1,0,1, //农历2066年闰五月小 
    0,1,0,1,0,1,1,0,1,0,1,0, 
    1,0,1,0,0,1,1,0,1,1,0,1, 
    0,1,0,1,0,0,1,0,1,1,1,0,1, //农历2069年闰四月小 
    0,1,0,1,0,0,1,0,1,1,0,1, 
    1,0,1,0,1,0,0,1,0,1,0,1,1, //农历2071年闰八月小 
    1,0,1,0,1,0,0,1,0,1,0,1, 
    1,0,1,1,0,1,0,0,1,0,1,0, 
    1,0,1,1,0,1,0,1,0,1,0,1,0, //农历2074年闰六月小 
    1,0,1,0,1,1,0,1,0,1,0,1, 
    0,1,0,1,0,1,0,1,1,0,1,0, 
    1,0,1,0,0,1,0,1,1,1,0,1,0, //农历2077年闰四月小 
    1,0,1,0,0,1,0,1,1,0,1,1, 
    0,1,0,1,0,0,1,0,1,0,1,1, 
    1,0,1,0,1,0,0,1,0,0,1,1,1, //农历2080年闰三月小 
    0,1,1,0,1,0,0,1,0,0,1,1, 
    0,1,1,1,0,0,1,0,1,0,0,1,1, //农历2082年闰七月小 
    0,1,1,0,1,0,1,0,1,0,1,0, 
    1,0,1,0,1,1,0,1,0,1,0,1, 
    0,1,0,0,1,1,0,1,1,0,1,0,1, //农历2085年闰五月大 
    0,1,0,0,1,0,1,1,0,1,1,0, 
    1,0,1,0,0,1,0,1,0,1,1,1, 
    0,1,0,1,0,0,1,0,0,1,1,1,0, //农历2088年闰四月小 
    1,1,0,1,0,0,0,1,0,1,1,0, 
    1,1,1,0,1,0,0,1,0,0,1,1,0, //农历2090年闰八月小 
    1,1,0,1,0,1,0,1,0,0,1,0, 
    1,1,0,1,1,0,1,0,1,0,1,0, 
    0,1,1,0,1,0,1,1,0,1,0,1,0, //农历2093年闰六月大 
    0,1,0,1,0,1,1,0,1,1,0,1, 
    0,1,0,0,1,0,1,0,1,1,1,0, 
    1,0,1,0,0,1,0,0,1,1,1,0,1, //农历2096年闰四月小 
    1,0,1,0,0,0,1,0,1,1,0,1, 
    1,1,0,1,0,0,0,1,0,1,0,1, 
    1,1,0,1,1,0,0,1,0,0,1,0,1, //农历2099年闰二月小 
    1,1,0,1,0,1,0,1,0,0,1,0   //设农历2100年腊月小
};
int runyue[301][3]=
{
    1800,13,4,
    1801,12,0,
    1802,12,0,
    1803,13,2,
    1804,12,0,
    1805,13,6,
    1806,12,0,
    1807,12,0,
    1808,13,5,
    1809,12,0,
    1810,12,0,
    1811,13,3,
    1812,12,0,
    1813,12,0,
    1814,13,2,
    1815,12,0,
    1816,13,6,
    1817,12,0,
    1818,12,0,
    1819,13,4,
    1820,12,0,
    1821,12,0,
    1822,13,3,
    1823,12,0,
    1824,13,7,
    1825,12,0,
    1826,12,0,
    1827,13,5,
    1828,12,0,
    1829,12,0,
    1830,13,4,
    1831,12,0,
    1832,13,9,
    1833,12,0,
    1834,12,0,
    1835,13,6,
    1836,12,0,
    1837,12,0,
    1838,13,4,
    1839,12,0,
    1840,12,0,
    1841,13,3,
    1842,12,0,
    1843,13,7,
    1844,12,0,
    1845,12,0,
    1846,13,5,
    1847,12,0,
    1848,12,0,
    1849,13,4,
    1850,12,0,
    1851,13,8,
    1852,12,0,
    1853,12,0,
    1854,13,7,
    1855,12,0,
    1856,12,0,
    1857,13,5,
    1858,12,0,
    1859,12,0,
    1860,13,3,
    1861,12,0,
    1862,13,8,
    1863,12,0,
    1864,12,0,
    1865,13,5,
    1866,12,0,
    1867,12,0,
    1868,13,4,
    1869,12,0,
    1870,13,10,
    1871,12,0,
    1872,12,0,
    1873,13,6,
    1874,12,0,
    1875,12,0,
    1876,13,5,
    1877,12,0,
    1878,12,0,
    1879,13,3,
    1880,12,0,
    1881,13,7,
    1882,12,0,
    1883,12,0,
    1884,13,5,
    1885,12,0,
    1886,12,0,
    1887,13,4,
    1888,12,0,
    1889,12,0,
    1890,13,2,
    1891,12,0,
    1892,13,6,
    1893,12,0,
    1894,12,0,
    1895,13,5,
    1896,12,0,
    1897,12,0,
    1898,13,3,
    1899,12,0,
    1900,13,8,
    1901,12,0,
    1902,12,0,
    1903,13,5,
    1904,12,0,
    1905,12,0,
    1906,13,4,
    1907,12,0,
    1908,12,0,
    1909,13,2,
    1910,12,0,
    1911,13,6,
    1912,12,0,
    1913,12,0,
    1914,13,5,
    1915,12,0,
    1916,12,0,
    1917,13,2,
    1918,12,0,
    1919,13,7,
    1920,12,0,
    1921,12,0,
    1922,13,5,
    1923,12,0,
    1924,12,0,
    1925,13,4,
    1926,12,0,
    1927,12,0,
    1928,13,2,
    1929,12,0,
    1930,13,6,
    1931,12,0,
    1932,12,0,
    1933,13,5,
    1934,12,0,
    1935,12,0,
    1936,13,3,
    1937,12,0,
    1938,13,7,
    1939,12,0,
    1940,12,0,
    1941,13,6,
    1942,12,0,
    1943,12,0,
    1944,13,4,
    1945,12,0,
    1946,12,0,
    1947,13,2,
    1948,12,0,
    1949,13,7,
    1950,12,0,
    1951,12,0,
    1952,13,5,
    1953,12,0,
    1954,12,0,
    1955,13,3,
    1956,12,0,
    1957,13,8,
    1958,12,0,
    1959,12,0,
    1960,13,6,
    1961,12,0,
    1962,12,0,
    1963,13,4,
    1964,12,0,
    1965,12,0,
    1966,13,3,
    1967,12,0,
    1968,13,7,
    1969,12,0,
    1970,12,0,
    1971,13,5,
    1972,12,0,
    1973,12,0,
    1974,13,4,
    1975,12,0,
    1976,13,8,
    1977,12,0,
    1978,12,0,
    1979,13,6,
    1980,12,0,
    1981,12,0,
    1982,13,4,
    1983,12,0,
    1984,13,10,
    1985,12,0,
    1986,12,0,
    1987,13,6,
    1988,12,0,
    1989,12,0,
    1990,13,5,
    1991,12,0,
    1992,12,0,
    1993,13,3,
    1994,12,0,
    1995,13,8,
    1996,12,0,
    1997,12,0,
    1998,13,5,
    1999,12,0,
    2000,12,0,
    2001,13,4,
    2002,12,0,
    2003,12,0,
    2004,13,2,
    2005,12,0,
    2006,13,7,
    2007,12,0,
    2008,12,0,
    2009,13,5,
    2010,12,0,
    2011,12,0,
    2012,13,4,
    2013,12,0,
    2014,13,9,
    2015,12,0,
    2016,12,0,
    2017,13,6,
    2018,12,0,
    2019,12,0,
    2020,13,4,
    2021,12,0,
    2022,12,0,
    2023,13,2,
    2024,12,0,
    2025,13,6,
    2026,12,0,
    2027,12,0,
    2028,13,5,
    2029,12,0,
    2030,12,0,
    2031,13,3,
    2032,12,0,
    2033,13,11,
    2034,12,0,
    2035,12,0,
    2036,13,6,
    2037,12,0,
    2038,12,0,
    2039,13,5,
    2040,12,0,
    2041,12,0,
    2042,13,2,
    2043,12,0,
    2044,13,7,
    2045,12,0,
    2046,12,0,
    2047,13,5,
    2048,12,0,
    2049,12,0,
    2050,13,3,
    2051,12,0,
    2052,13,8,
    2053,12,0,
    2054,12,0,
    2055,13,6,
    2056,12,0,
    2057,12,0,
    2058,13,4,
    2059,12,0,
    2060,12,0,
    2061,13,3,
    2062,12,0,
    2063,13,7,
    2064,12,0,
    2065,12,0,
    2066,13,5,
    2067,12,0,
    2068,12,0,
    2069,13,4,
    2070,12,0,
    2071,13,8,
    2072,12,0,
    2073,12,0,
    2074,13,6,
    2075,12,0,
    2076,12,0,
    2077,13,4,
    2078,12,0,
    2079,12,0,
    2080,13,3,
    2081,12,0,
    2082,13,7,
    2083,12,0,
    2084,12,0,
    2085,13,5,
    2086,12,0,
    2087,12,0,
    2088,13,4,
    2089,12,0,
    2090,13,8,
    2091,12,0,
    2092,12,0,
    2093,13,6,
    2094,12,0,
    2095,12,0,
    2096,13,4,
    2097,12,0,
    2098,12,0,
    2099,13,2,
    2100,12,0
};
//获取当前阴历年份是否是闰月年
bool isrunyue(int year)
{
    int i;
    for(i=0;i<301;i++)
    {
        if(runyue[i][0]==year)
        {
            if(runyue[i][1]==13) 
            {
                return true;
            }
        }
    }
    return false;
}
//获取公历年的天数
int year_alldays(int year)
{
    if((year%4==0 && year%100!=0) || year%400==0) return 366; else return 365;
}

//获取公历年初至某整月的天数
int year_sumday(int year,int month)
{
    int sum=0;
    int rui[12]={31,29,31,30,31,30,31,31,30,31,30,31};
    int ping[12]={31,28,31,30,31,30,31,31,30,31,30,31};
    int ruiflag=0;
    if((year%4==0 &&year%100!=0) || year%400==0) ruiflag=1;
    for(int index=0;index<month-1;index++)
    {
        if(ruiflag==1) sum+=rui[index];else sum+=ping[index];
    }
    return sum;
}

//获取阴历年份的在初始数组里的坐标
int getzuobiao(int year)
{
    int i,k=0;
    for(i=0;i<301;i++)
    {
        if(runyue[i][0]<year) k+=runyue[i][1];
    }
    return k;
}
//获取阴历闰月的月份 传入参数为阴历年份
int getrunyue(int year)
{
    int i;
    for(i=0;i<301;i++)
    {
        if(runyue[i][0]==year)
        {
            if(runyue[i][1]==13) 
            {
                return runyue[i][2];
            }
        }
    }
    return 0;
}
//获取阴历年份的在初始数组里的坐标
int getzuobiao2(int year,int month)
{
    int zuobiao1=getzuobiao(year);
    int tmp;
    if(isrunyue(year)==true)
    {
        tmp=getrunyue(year);
        if(month>=tmp)
        {
            zuobiao1=zuobiao1+month;
        }
        else
        {
            zuobiao1=zuobiao1+month-1;

        }

    }
    else
    {
        zuobiao1=zuobiao1+month-1;
    }
    return zuobiao1;
}
//获取从公历1800年1月25日至当前日期的总天数
int get_g_alldays(int year,int month,int day)
{
    int i=1800,days=-24;
    while(i<year)
    {
        days+=year_alldays(i);
        i++;
    }
    int days2=year_sumday(year,month);
    return days+days2+day;
}
//获取农历数组的累计天数
int get_n_days(int zuobiao)
{
    int i=0,days=0;
    while(i<zuobiao)
    {
        if(nongli[i]==1) days+=30;else days+=29;
        i++;
    }
    return days;
    
}
void get_n_ymd(int alldays,int &year,int &month,int &day)
{
    int zuobiao=0;
    int days=0;
    while((alldays-days)>30)
    {
        days=get_n_days(zuobiao);
        zuobiao++;
    }
    //printf("\n %d\n",days);
    day=alldays-days;
    int zuobiao2=0;
    int i=0,ryue=0;
    while(1)
    {
        zuobiao2+=runyue[i][1];
        if(zuobiao-zuobiao2<13) 
        {
            year=runyue[i+1][0];
            ryue=runyue[i+1][2];
            month=(zuobiao-zuobiao2);
            break;
        }
        i++;
    }
    if(month==0) {month=12;year--;}

}
//获取从阴历1800年1月1日至当前日期的总天数
int getalldays(int year,int month,int day)
{
    int zuobiao=getzuobiao2(year,month);
    int i,days=0;
    for(i=0;i<zuobiao;i++)
    {
        if(nongli[i]==1) days+=30;else days+=29;
    }
    return days+day;
}
bool n_check(int year,int month,int day)
{
    int zuobiao=getzuobiao2(year,month);
    if(year>2100 || year<1800) return false;
    if (month>12) return false;
    if (day>30) return false;
    if(nongli[zuobiao]==1 && day>30) return false;
    if(nongli[zuobiao]==0 && day>29) return false;
    return true;
}
bool y_check(int year,int month,int day)
{
    int zuobiao=getzuobiao2(year,month);
    if(year>2100 || year<1800) return false;
    if (month>12) return false;
    if (day>31) return false;
    return true;
}
int main()
{
    /*
    printf("%d\n",getzuobiao(1945));
    if(isrunyue(1944)==false) printf("不是闰月年\n"); 
    else 
    {
        printf("是一个闰月年\n");
        printf("所润的月份是%d\n",getrunyue(1944));
    }
    printf("坐标2是%d\n",getzuobiao2(1944,4));
    printf("从1800.1.1到当前日期的天数是%d\n",getalldays(1945,05,05));
    //printf("从1800.1.1到当前日期的天数是%d\n",getalldays(1800,04,05));
    //printf("从1800.1.1到当前日期的天数是%d\n",getalldays(1800,10,15));
    
    int syear,smonth,sday;
_input:
    printf("请输入阴历年月日例如2012,11,30==");
    scanf("%d,%d,%d",&syear,&smonth,&sday);
    if(n_check(syear,smonth,sday)==false) 
    {
        printf("输入日期有错误,请重新输入\n");
        goto _input;
    }
    int n_days=getalldays(syear,smonth,sday);
    int g_days=days1800;;
    int iyear=0;
    for(iyear=1801;iyear<2101;iyear++)
    {
        if(n_days-g_days>365)
        {
            g_days+=year_alldays(iyear);
        }
        else
        {
            break;
        }

    }
    int imonth,iday;
    int g_days2=g_days;
    for(imonth=1;imonth<=12;imonth++)
    {
        if((n_days-g_days)>31)
        {
            g_days=g_days2+year_sumday(iyear,imonth);
        }
        else
        {
            if(imonth==1) imonth++;
            break;
        }

    }
    imonth--;
    iday=n_days-g_days;
    if(iday==0) {iyear--;imonth=12;iday=31;}
    printf("转换公历后:%d 年 %d  月 %d 日 \n",iyear,imonth,iday);
    */
    int syear,smonth,sday;
    _input:
    printf("请输入阳历年月日例如2012,11,30==");
    scanf("%d,%d,%d",&syear,&smonth,&sday);
    if(y_check(syear,smonth,sday)==false) 
    {
        printf("输入日期有错误,请重新输入\n");
        goto _input;
    }
    int days=get_g_alldays(syear,smonth,sday);
    int year=0,month=0,day=0;
    get_n_ymd(days,year,month,day);

    printf("%d/%d/%d\n",year,month,day);
    //printf("%d",days);
    return 0;
}