結果
問題 | No.313 π |
ユーザー | mamekin |
提出日時 | 2015-12-20 13:48:36 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 6 ms / 5,000 ms |
コード長 | 22,111 bytes |
コンパイル時間 | 785 ms |
コンパイル使用メモリ | 94,052 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-17 12:11:38 |
合計ジャッジ時間 | 1,734 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 5 ms
6,816 KB |
testcase_01 | AC | 6 ms
6,940 KB |
testcase_02 | AC | 5 ms
6,944 KB |
testcase_03 | AC | 5 ms
6,944 KB |
testcase_04 | AC | 5 ms
6,940 KB |
testcase_05 | AC | 5 ms
6,944 KB |
testcase_06 | AC | 5 ms
6,944 KB |
testcase_07 | AC | 5 ms
6,940 KB |
testcase_08 | AC | 5 ms
6,944 KB |
testcase_09 | AC | 5 ms
6,940 KB |
testcase_10 | AC | 6 ms
6,940 KB |
testcase_11 | AC | 6 ms
6,940 KB |
testcase_12 | AC | 6 ms
6,940 KB |
testcase_13 | AC | 6 ms
6,940 KB |
testcase_14 | AC | 6 ms
6,940 KB |
testcase_15 | AC | 6 ms
6,944 KB |
testcase_16 | AC | 6 ms
6,944 KB |
testcase_17 | AC | 6 ms
6,940 KB |
testcase_18 | AC | 6 ms
6,940 KB |
testcase_19 | AC | 6 ms
6,940 KB |
testcase_20 | AC | 5 ms
6,940 KB |
testcase_21 | AC | 5 ms
6,944 KB |
testcase_22 | AC | 5 ms
6,944 KB |
testcase_23 | AC | 5 ms
6,944 KB |
testcase_24 | AC | 5 ms
6,940 KB |
testcase_25 | AC | 5 ms
6,940 KB |
testcase_26 | AC | 6 ms
6,944 KB |
testcase_27 | AC | 6 ms
6,944 KB |
testcase_28 | AC | 5 ms
6,940 KB |
testcase_29 | AC | 5 ms
6,944 KB |
testcase_30 | AC | 5 ms
6,944 KB |
testcase_31 | AC | 5 ms
6,944 KB |
testcase_32 | AC | 6 ms
6,940 KB |
testcase_33 | AC | 5 ms
6,940 KB |
ソースコード
#include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> using namespace std; const int X = 1685440109; const int MOD = 2000000087; const int LENGTH = 100; const int HASH[] = {1304870943,1222308804,856659083,573706211,903562102,139368700,618056013,857337317,859267611,80648086,1903707123,323802675,294879715,1897456050,782337176,1676954282,248239388,147753512,587130312,552047418,1165304885,583521786,1987503650,1748198380,205256137,1660315401,1937816216,971397263,1129613586,465118785,407272302,1948552067,560936956,1996817570,341161203,1426060027,1418596838,842548655,1865364132,3761403,1947642072,1539119686,1585965111,1010206626,1431370011,846422532,1563972766,1675762127,522718631,1295430637,1621774148,1707072550,1523593815,1031252886,1304505993,1414966618,609690565,1936152480,861389048,1362037727,501722530,1890576133,370797064,1216583701,839846616,925877293,57270073,1135597263,54853624,666551350,1756299051,1962034085,184655805,816102885,801477018,633279011,1695813359,558901082,444810109,797869818,1701510594,824237592,796262649,1433603537,1080997994,381439808,861017723,1144874445,1505688542,401384603,621125768,1579038127,1073511899,899517923,206729818,1925942941,1168720861,108184359,1705514834,673319247,105417882,349570581,951125186,822626157,1036671003,1485014905,930970575,1462805769,927192339,284749034,1962572402,153681831,500572476,1098300421,82717116,392661212,813378564,1331388526,434274801,1157152119,969450781,593360507,1016421083,488633128,661768962,553537515,1679390474,1522786599,1727710188,157835395,1287881532,1002463209,64836022,679707986,1186297103,359034490,192067785,1847129671,1562474533,1245758998,81673076,800749527,566937528,1626425542,1939517693,1711345193,1677491725,1664370903,42850200,107051652,533932747,1701964814,746000356,24561891,340873926,1467248166,552865892,1667422132,1950919682,291015254,46355076,527987841,505601729,461569694,1686228956,1391592399,1686211668,232411720,247365818,1153540931,1615369474,331093781,1432409690,1361944987,451331595,512883287,239234209,1161577224,1930928600,1230027308,909047286,803313444,1503146640,1403268801,1045662233,275826412,554977768,1057608958,598985104,1640606683,1324750680,350892842,1537687676,433121053,619404541,1755179107,1866857255,711329864,374510345,1541686310,596520393,333161386,343815740,741648410,1951900877,1051618126,791591650,1521497399,498200715,1934081089,248969330,847385057,1577785706,477493504,1018471440,982065863,1394159113,1526877801,21783514,618046565,259960177,1515847776,1708421483,1641134641,1949728321,1575717233,1888200344,1829138319,1221835924,869110728,72311007,836911062,987563238,1152179607,1590754883,1365427169,1195099412,170994782,489963239,660708204,1671948085,3049319,1210609442,1341353840,957793002,1213695765,563583989,1184190070,906977123,1997940539,764067654,850097597,1474538936,922892887,379577167,501960064,1570287731,1544659810,277750468,480413825,546410550,408186106,1015861642,794480442,296243675,1487376541,1049720687,454671648,1075862155,61005790,692797914,1486249600,1055866897,1799729748,1949864147,1150632301,1332321826,2105159,712283400,814413571,1825805284,1908711869,1479745765,1690634833,247694965,1818687608,805319962,799496966,1725401194,1052605055,1271810671,1037206577,529241922,918032907,395211566,1784246070,387745242,1832127146,1796266047,1852337633,105195170,523863211,1443650933,538821034,314752836,310962423,425551886,855483110,1305380230,471786055,313892210,571273809,1448991971,594820692,1669284058,242069748,215271800,472956378,534652451,1969550876,225889253,285829612,1898421900,144423996,1944765449,1398971162,610858998,1248853349,865384063,1460394991,1900477490,1714574004,1012760679,1000078029,355661587,1830288393,62162401,948547996,1168213351,679026573,1762252885,1443157253,787916644,585417319,567286815,51973611,491514428,1454381602,1087496386,1774789335,598354465,398210539,959092418,98114280,738104861,818818616,1842020250,1318961613,1555200378,977119809,65012465,133681431,752683306,1328920585,1773256344,660367385,369966903,100368224,775375366,1700129006,1078029000,1012541933,942611676,1277826542,584768166,1415750974,700362846,1153732789,1182278858,1751572749,433547052,435951467,512528784,556646763,1863657790,682522495,1518769047,137652623,770911639,1954494220,493249998,933048455,1539435992,343302866,600731045,325508652,526515338,1270140564,626868282,405226188,63928023,1053227646,228544153,145397933,626354129,1818570719,838512602,727005757,655463718,1797635462,1811907033,548318919,692386925,638795897,509952431,1199474041,649531731,255371703,924010624,1020653710,606767018,117202528,1798678429,1092484467,639764419,1369004124,865151150,1802984159,1261075323,1647632944,1969778730,1294826361,1705494738,1943469544,1505967050,1834810234,1266717920,527897166,1681867249,1442389509,549834766,1329087050,534064481,1710259643,1746565626,1881979952,694914534,1017595612,904256034,171491512,619361266,910274171,975079409,1288791919,62260891,735098235,889096147,536169309,957118039,1577678340,1097750696,1256965482,1216219340,1570651253,879945451,1180067142,462058458,1178185932,1536197685,956575600,91858609,420478963,1175795365,1382812307,1210089800,230221354,633771494,1536621699,1619348924,953768896,812326384,97464330,13162026,1283782054,680545227,1719236447,531912433,1662178831,225942501,1411105235,1777231764,629754779,1324866283,1766787282,1896895423,786393188,1200451464,1056741951,485241699,1575952918,234756162,946458740,636396977,1263248236,1912234715,208775797,1964271569,765749992,291142633,845689761,1505426024,1959011975,944598067,717873096,1407712307,1197356955,1775569446,945745589,1173775201,1663305,1685282156,667454717,1479940624,80183144,387077597,1624692584,1776435016,769867799,1274355711,1895997856,547782250,659998002,224265257,1945759249,740308885,1966717180,1502813260,632659232,1134570373,25033681,373944681,257673183,1913837838,1393853068,829796693,86498191,515009706,466887800,1183357534,1263012488,597431517,726743343,1844313547,524830767,29101389,755672514,783129041,1327876911,1145525930,1364913065,1763089342,1429170746,605756716,689387875,54761641,295025913,506016622,370677516,1046440601,402329595,526394984,538363004,1420651403,1671946652,508577636,685033623,1015718712,825999265,553825726,1749396780,1425953805,45557847,1308913954,852088349,669166338,1082682370,1555247657,840254096,936143015,116996507,1364863600,642478375,799763496,786540675,1095529334,1633349493,75527526,561267254,1297019891,1076399197,1038379547,1855430126,639899858,1078057099,968198294,753718793,1250754449,49238731,1885805927,154559851,24008246,527560024,909659487,193001227,77773069,1937313129,126649030,1882850062,1352204932,192851089,1508629737,1504745751,1618375989,1628537937,1432488607,624514075,1285152852,320964702,341479188,1916861715,339595780,1660530078,1010880627,859796167,1201115776,170657826,1613369349,581907786,218583006,1070824315,431932611,1986095795,14226814,1328694805,1234337182,1539672716,1309338501,30567811,1893592660,192459297,518254634,1981027609,1504161356,243190149,995329060,1828922690,1687257911,1755630721,250709667,383701074,172680635,476956249,924613364,993555658,1425108219,1712649579,1252980428,1780231895,1792822027,961587908,392186042,8237931,1443742052,1136514381,1238676711,1541702806,19788755,804237843,178005827,352573758,1440908750,697532571,1775749160,1812513211,352588735,37483959,755639968,1499639540,580176658,1230548339,54415109,946092095,1197199284,1573350561,1917681484,1418830454,827757948,1691307145,1925720519,871862663,1492910745,150267345,1429771778,929329306,849366284,521003244,205802985,1137358915,1658508714,974891332,1591798176,1715049802,1238369321,945860696,1055093400,321282518,1723679141,1227765448,864232483,1726317022,1246746232,367773726,524214585,1786577047,1857911931,1528931846,562122355,1414427454,307468614,1859929124,1376632324,467407202,1830859816,247779916,543676675,405990794,1355014609,1429387667,1146882399,1531326757,1779232313,1188184391,1836315097,1010222386,1965113221,1356756550,944766083,413664328,140084221,785295456,1635995187,1118205067,435621104,387617503,1813082480,1409174687,664260469,27763040,1017402980,657454132,1658659365,444991616,1607999975,1792787990,150148064,1297092428,905603343,1602793088,469434759,1228671372,193023657,205725407,1410026488,1102756941,1039199556,168001752,1036862330,1420398114,1697368314,490594301,1395677992,166758324,799029970,351452688,1100801612,1438639393,1411782285,1069066382,1355170072,188646833,554619702,998140380,1503941074,1611184193,285046358,1118252591,898298063,535081916,1793197190,1766952645,1081763340,1330500561,1439268777,929385108,959350207,1968137403,1639081303,552338271,324012753,150400061,1844738292,619019265,728411654,803427967,528089839,1009709214,622328359,1815696504,875416151,1798455021,34871270,1949158787,427133942,1169892810,165232923,817209478,118737523,1276924377,1666485223,1771873734,506626654,1126321806,605419462,360545832,1990837372,1577357880,873366515,1661773164,1352676352,683441426,1736081306,1460443644,693205039,1384054579,1163337367,801767962,242377919,1438885504,291137725,244037993,1614497325,258651994,778713646,621720788,735251877,1908608172,988977334,842618509,1927135721,526927471,544369251,87365378,1356428691,565321366,814010591,130867816,1369114979,806156536,167677876,1203635047,1385514462,1823451488,197219108,1402574253,1187505376,635937166,494775165,194187126,1923085009,1517440449,430680693,500879455,660912529,1573154676,1748201162,1862717006,646276569,1150826529,1898576594,666778133,504641498,1893725833,1773142864,1158876095,110226630,51597261,1322402879,246667150,978332390,1783295043,274049101,816515264,370677337,1370743771,569436359,1896447310,238365784,431722349,446212708,519344995,1013877090,1913888567,294137502,1305681867,1918830574,48453439,1232645591,36349753,117220376,741477690,822817029,791057313,275782261,694245698,1348830699,713221993,562076532,868854739,1382349366,586070152,1076477729,963079754,1556025416,1126673579,1432353090,716133689,504231703,469921723,1119126332,1578424499,1861014602,1300210096,1620118179,908891855,1218885132,1290072145,970232128,1984023209,1523930717,202601469,796743571,419560508,230752817,955325805,1178415662,417105840,496172016,358278292,890481009,1919453997,730198385,1057506025,433469659,1461202863,244243507,1158039234,602121055,1202483181,1497828457,436051636,189722636,587488476,623553198,1413812895,572010802,1821589958,1807998489,1195987768,1005647262,780413231,1738231583,251272403,262819220,516003297,463808278,883816341,1435556582,552931033,1517183113,1148842918,1743516125,401419860,1433986453,594858107,1750569518,483398274,81248683,56409743,635734889,479579277,1329145898,1574523725,1847861243,30006614,1510042525,1455241885,1133808783,1905313199,1164449762,305768490,1153257084,79240967,469124011,1252440322,1447489025,918496555,1066976608,1203603441,473021553,750065629,916435305,146904333,549529300,115871896,960651982,1401537255,242762605,230384508,876217889,1568229743,1397930162,1246262671,451665184,54722265,1398638260,728963820,1036561987,1268992330,266484846,1930970549,986569820,1756091637,1078752669,1363565360,35109809,4447004,1227315707,409760583,428539280,1120313076,728872671,355373003,363182451,706325697,597908561,417295755,611037382,1145289752,545828709,1589113060,1159153549,1794399639,1055003588,893118320,977719945,1422743020,804894528,1068976907,987465707,843989396,1202354617,1307560065,24437570,615576342,528401049,1260991257,1854536890,1557673859,213532120,660878992,501662013,1590126239,493421952,1785105123,1764906834,1768181964,1242650719,1145309561,1837345715,1443535454,1846025533,1576751898,62305455,1463056334,1529146917,447092291,1341202527,1898971360,1910144529,491835411,834167886,1153744547,1531377822,378107989,1559490709,1039783920,443235354,1284802026,1077302970,514377851,1247282100,1795458506,114404552,855242295,965492241,1562318598,787192843,537819290,354698778,1465777544,591500914,852580875,1234600531,1130122483,68666010,410811628,743531463,1335947175,1352562415,450757634,1738538044,442541621,311067924,229958873,1140245130,1552814586,489184056,119975262,1714173455,1255206962,5381661,1771858007,1526259349,632006073,613141035,199001889,550205007,533196207,1427594056,1555267000,933024478,1564119504,56450578,1018940820,1808319647,298303901,717785588,44167175,1343370946,1496779973,740494171,1487174073,1249886983,727053824,286422004,1617448628,652719612,1404224944,616368335,660210307,382843863,766162594,1944828967,1383124374,167872785,1619399420,179115017,513201838,176514128,1984392221,813263301,1141919057,522029294,882008954,584310185,1372297197,622103932,440604884,1172142637,900548928,114262568,1004134376,1297759156,408788239,1222832194,981445180,1189352819,1738420305,1655417871,465577087,1994951719,1805250264,114268063,162717708,1263683357,1468010963,512519186,698161307,1817039972,1548745594,1523457756,473452416,317786559,135939194,612515980,1577456171,1285339951,864333425,759908849,1493501241,743930334,1539975706,833891906,335780860,1252496094,1063231757,582927853,399873479,626339193,1157555877,511761358,151861235,1242189032,10017104,243148797,671306303,1283329959,659468144,85606725,1900094498,1355562521,1572029980,609322782,1107670351,465113079,1787509484,1923636040,1388132972,882277220,236105547,1580759704,1203397338,1246089752,1512579474,235601721,1717954346,1429596089,284118020,1049144870,494347517,1255535798,1199106204,102206357,956086066,1952268637,895182713,611439722,499032077,599099040,162049390,1178412169,1818788772,1852185572,1792074352,1122511501,633486840,660436205,1818111115,664454723,446396380,1954295658,1822334463,817666978,1274138666,930383673,895130102,1476036481,144757106,1179527397,782691959,600535611,1975784653,1888541017,185792916,330332486,1569950267,1501300132,599622072,1054054269,203249384,458218174,469253070,625939873,646709942,1018628723,1998717971,1683448553,898242833,1908210569,1397925907,1852218914,1376799194,1581296663,517770090,718462698,957789159,905501132,467067239,1778984853,1240899511,780074707,773875305,1433342169,937760207,1791175375,1155879151,1752387365,1490619819,1824615205,1894570327,881496087,173728327,356978078,186374143,1473283176,1510091724,1104266945,713439510,275380564,1376022032,68944610,65735487,849236019,686466503,764006581,210636288,290687052,1716688454,1749353360,1509570131,700622081,770325330,990518754,1082150344,769512291,1548292581,1617981036,70004066,1278659866,1931933000,1091301763,602267355,960314619,690993666,669521873,223148999,876108819,907135387,912524056,949143634,1782921744,1414433379,1250559030,112902403,456692160,1298940164,1366140370,1815399834,649980064,1203923182,357247093,623452068,1193642570,1100007927,1286611591,736139972,763321215,892792584,1837444867,542029505,364378084,1358317131,1371779150,555550420,1582029454,207984795,396306847,969504397,177165040,443020081,1069549672,230145214,465939913,1728020490,897855579,1197066344,644977375,997915160,1186482518,689937802,1807975214,1289759312,670671192,1945316655,1785270651,38010040,1605348066,1895617789,1911157992,1078584970,527867281,1236707611,718666951,805844521,92925835,635845272,921525599,639644452,1538337970,1575329183,1224700925,1155911770,941395794,492319405,1739310342,1118831794,1842743818,757879715,1207264857,298544974,823199019,1129775620,1670207225,1113060926,102733676,1354206395,1679983923,1844232182,1746089088,412875765,1448325101,173105811,482015200,717793493,1777282969,1024315422,1006213454,900120253,1384938446,501441403,680141986,1432161713,109702778,1178761786,528285963,539453815,1004797581,766445191,1378402195,1171073329,188051318,1157954809,1760818659,1768977145,1368574327,1018762706,1318064186,1137398984,154224252,154005318,1107102816,873672546,1575126528,540494306,1504215120,1223054774,283845178,944654157,1571932527,921234107,1871086129,1067060181,1168843570,404136079,176531663,1599819297,1312304065,1421763303,1983737658,852577487,1464727700,1710414740,731230322,284210773,703719111,64345976,1386016781,328087556,1429954572,1976996294,1515650040,1050109589,658890838,1982978037,415611611,1279683412,305312722,1958716498,1830430981,1542135943,1067836757,367813338,102636347,776419798,613641083,1447709831,235223300,312935044,1070976065,1506809710,714954817,192140117,650242379,106172702,1761426341,332556079,1302488339,1443349584,1020314422,1876397731,1360437556,898993025,285360706,1833290055,1517763121,1346754529,1395350852,400584408,682368313,1151347469,1321725201,1175560609,1530917176,587146377,287977418,835630068,1371253514,1849223134,209726313,1432768744,513856235,1444018709,376413134,770744726,1056893595,1270801754,1811706694,491739125,843159833,1823912112,656886891,1038163115,1795486433,57092785,1382061113,39222853,1940761894,1803918756,1853801404,95562711,674406365,159188530,806047725,373137567,258624404,1819220450,3857786,1168924905,325416555,1869857865,1893098523,592356295,1190909967,1019395926,1866336654,457473150,203480796,1069991580,159273809,859814176,884284228,1717875143,1852195966,1588447981,847513179,1200846469,1729221086,1104675612,1446214459,673680615,1714455974,1466875783,1418652970,1650437734,1195553212,1939454845,1179824110,702055314,121456933,794458655,1143311881,663982142,772573211,765419465,1464962358,901561365,104186941,76380790,506490632,1375220508,1248184118,736395216,848899262,1703785871,1237839066,1486234554,1672161610,555884400,1373622969,1600129405,228316902,423386778,144584169,1307591716,375151357,15240169,975023209,639808888,315557145,345773893,1991015479,297306703,1531236878,883778197,70557669,1849083207,373543331,997830620,295356702,1293498034,80725947,573658184,794905903,1645886035,475990708,1830395620,1699683167,1291707870,1856851519,599334134,370493335,1837375015,1891683966,1723411065,947373227,739968068,942970331,48512038,810985453,1203589195,938013869,1498080714,187579737,551124811,647354325,850076373,522265211,1214248754,175651101,602828380,427664644,152368585,1117008824,612303927,229817827,1309756092,1385641907,1644920042,1404095194,427996138,1283175031,542205094,770761730,701981633,1806900769,210775276,1980509936,1734729628,240864628,1022671295,1123013130,1510327873,467472764,438430707,456106250,479899602,1352821912,140304400,1510482926,1949036469,503585767,1290186320,828793577,399912878,1113718146,1845526225,1081331449,935623819,763913110,1009542194,1088438989,1484466716,1404403937,1072064096,1409578306,1326150574,1881806683,861573527,336345932,325132902,501165443,282118299,1502223289,730261533,1213794048,954713064,568740276,89350049,1956064516,1474658569,866298068,1086778454,508053585,986418680,210301954,1636950240,766708063,1909430707,649589442,1044989397,1824637793,269643539,1607106689,1481747725,468702385,583898184,879675381,1992176470,288624834,1435536608,1674619408,323100105,349057461,320179983,1165277938,373601385,1182526140,1543687317,1922142131,91030913,677205670,404310469,379915924,48659502,1004048011,1070304130,870401431,972517609,766259480,1881736677,1754354459,1499278731,1927485208,1648235272,958996185,1742445377,1560083480,1447635967,275614550,1930758335,155899821,1087158661,452360783,274788141,665695392,1296212268,681554429,1279962251,551433168,1099846723,451462480,672533322,317326139,129397607,1807192134,457111811,795306287,1933237782,34850207,415151380,346752386,390634234,1818472520,672980757,1855351661,175829710,1455439931,51975274,1971810621,1035766943,681824432,440385937,1826186427,1261976696,1119900016,1366902581,670640620,1174532003,150220532,229880814,1018479510,1843180107,1107561620,1200084347,1955731545,1404899362,455298439,790914916,793839029,287192589,798082870,478759252,1689493878,484295738,1042926369,1006258236,270789758,956077324,1123159935,570396373,1875953024,315110235,1023339749,1877923345,1463616451,153016968,1288875818,751192960,1253805,374639521,437218636,1348860857,134471981,421209247,972735714,490413322,859748909,1712539585,1085867632,1569303398,760178603,579258137,177504774,1779026243,1445989069,557158002,1404474225,26104225,136037846,938463386,637297766,860046960,508577699,1314045901,82048813,153666952,1424871874,1986046901,1649311253,1497630241,1163843944,658629469,793814225,1097805759,1113408331,489445373,484336839,1785020619,498633082,917981578,295160499,588739426,233840244,1851036659,1079424721,65492361,624508112,1512598814,825424179,349559924,1295067246,485091354,1079239168,900257546,1361611861,1746599008,1430718177,18498361,939994608,261227576,1966948013,1721012634,1036172154,723203496,734369577,35458442,1528435803,1484915126,679422076,1492300422,262938221,240939781,735145070,223812764,1165194510,320327510,1742307646,1032641063,1522485750,1844915643,32571212,1834972279,380092201,1113715196,565049141,1217480956,1206835257,1381261947,1116245371,377181039,97894288,559791868,225491415,190978037,1456871704,1455697107,544464148,1311439845,679028423,167225711,896459376,1115134217,221994568,1284174331,430431246,1028705337,749561825,1348790663,153317983,1008624080,1636125739,1386816418,1139043232,1720068980,1196550281,165904987,110828343,1021013544,1422633274,659170559,1254468325,291909899,1044900482,1661963535,14297184,959019642,1839368927,1988900250,1459966356,1739056041}; int getHash(const string& s) { int n = s.size(); long long hash = 0; for(int i=0; i<n; ++i){ hash *= X; hash += s[i]; hash %= MOD; } return (int)hash; } int main() { string s; cin >> s; if(s[0] != '3'){ cout << s[0] << " 3" << endl; return 0; } for(int i=0; ; ++i){ string t = s.substr(i*LENGTH+2, LENGTH); if(getHash(t) == HASH[i]) continue; for(int j=0; ; ++j){ for(char c='0'; c<='9'; ++c){ string u = t; u[j] = c; if(getHash(u) == HASH[i]){ cout << t[j] << ' ' << c << endl; return 0; } } } } }