HDU 4325 Vampire Numbers 打表

杭电服务器是慢啊。。

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <set>
#include <vector>
#include <map>
using namespace std;
#define ll long long
#define N 1000005
set<ll>s;
ll ans[1783]={
126,153,688,1206,1255,1260,1395,1435,1503,1530,1827,2187,3159,3784,6880,10251,10255,10426,10521,10525,10575,11259,11844,11848,12006,12060,12384,12505,12546,12550,12595,12600,12762,12843,12955,12964,13243,13545,13950,14035,14350,15003,15030,
15246,15300,15435,15624,15795,16272,17325,17428,17437,17482,18225,18265,18270,19026,19215,21375,21586,21753,21870,25105,25375,25474,25510,28476,29632,31509,31590,33655,33696,36855,37840,37845,39784,41665,42898,44676,45684,45760,45864,47538,
48672,49855,51759,52168,53865,56295,56875,62968,63895,67149,67392,67950,68800,71199,78975,100255,100525,101299,102051,102505,102510,102541,102550,102595,102942,
102955,103968,104026,104260,104368,105021,105025,105075,105210,105250,105264,105295,105723,105750,107163,107329,108126,108135,108216,108612,108864,109525,110758,112468,112509,112590,114268,115672,115699,116478,116496,116725,116928,117067,118408,118440,118480,118575,118926,119848,120006,120060,120384,120600,120762,120843,121086,121576,121815,122746,122764,123084,123354,123538,123840,123894,124483,124488,124542,124978,125005,125050,125095,125248,125433,125460,125500,125950,125995,126000,126027,126108,126846,127417,127620,128403,128430,128943,129438,129505,
129514,129550,129564,129595,129640,129775,129955,131242,132430,132565,132615,132655,133245,134275,134725,135045,135450,135828,135837,136525,136854,136948,138784,139500,139824,140035,140350,141345,142978,143500,143739,143793,145273,145314,145345,145683,146137,146520,146952,149364,149782,150003,150030,150246,150300,150435,150624,150826,152271,152406,152460,152608,152685,152946,153000,153436,154350,155277,156024,156240,156289,156325,156915,157950,158193,162072,162526,162720,162976,163255,163795,163854,163944,164583,165208,168520,171598,172246,172386,172822,
173250,173925,174028,174082,174208,174280,174298,174370,174793,174802,174820,174982,175329,176215,178294,178942,179325,179428,179482,180225,180297,180621,182065,182250,182650,182700,182974,184126,186624,187029,189702,189742,190260,190827,191205,192150,192375,192685,192717,193257,193945,194229,197428,197482,197725,201852,205785,207391,208624,210375,210681,210753,211896,212868,213075,213466,213750,213759,214506,215086,215424,215455,215860,216733,217503,217530,217638,217854,218488,218700,223524,226498,226872,226876,227448,229648,231579,231673,233896,236754,
236758,236925,238968,241506,241564,243175,245182,245448,246150,246928,250105,250510,251005,251050,251095,251896,253750,254740,255010,255100,256315,256410,256414,258795,259510,260338,261378,261783,262984,263074,263155,263736,267034,268398,279328,281736,283198,283648,284598,284760,285376,286416,286974,287356,289674,291375,291753,293625,295105,295510,296320,297463,297832,304717,307183,312475,312565,312655,312975,314199,314743,315009,315090,315490,315594,315625,315900,316255,319059,319536,325615,326155,326452,328419,328864,329346,329656,336195,336550,336960,
338296,341284,341653,342688,346288,346725,346968,347913,352966,355995,361989,362992,365638,368104,368550,368784,369189,371893,373864,375156,375615,376992,378400,378418,378450,381429,384912,384925,386415,390847,392566,393246,393417,394875,397840,399784,404932,404968,414895,415575,416065,416259,416650,416988,419287,428980,429664,435784,439582,442975,446760,446976,447916,449676,449955,450688,451768,456840,457168,457600,458640,462672,465088,465984,468535,475380,475893,476892,486720,488592,489159,489955,490176,491688,493857,495328,497682,498550,515907,516879,517509,517590,519745,520168,520816,521608,521680,526792,529672,530379,531297,535968,536539,538650,549765,559188,562950,564912,567648,568750,571648,573768,588676,611793,611878,612598,614965,617728,618759,623758,629680,632875,638950,649638,661288,665919,667876,671409,671490,671944,673920,678892,679500,687919,688000,692712,697248,702189,702918,710496,711099,711909,711990,715959,719199,729688,736695,738468,741928,769792,773896,778936,782896,785295,789250,789525,789750,791289,792585,794088,798682,809919,809937,809964,815958,829696,841995,859968,899019,936985,939658,960988,1000255,1000525,1002501,1002505,1002550,1002595,1002955,1004251,1005025,1005201,1005250,1005295,1008126,1009525,1012099,1012198,1012297,1012396,1012495,1012581,1012594,1012693,1012792,1012891,1012990,1014975,1016568,1016635,1017382,1019722,1020051,1020510,1020537,1021968,1021999,1024555,1024582,1024884,1025005,1025041,1025046,1025050,1025095,1025100,1025410,1025500,1025779,1025950,1025995,1029042,1029420,1029505,1029550,1029595,1029955,1031899,1032565,1032655,1032876,1039680,1040026,1040260,1040368,1041799,1042353,1042542,1042600,1043680,1043968,1045296,1046209,1050021,1050025,1050075,1050210,1050250,1050295,1050750,1051263,1051533,1051699,1052100,1052235,1052500,1052640,1052950,1052995,1053153,1053265,1053315,1057108,1057162,1057230,1057500,1058715,1058890,1061599,1062247,1062517,1063251,1064254,1065325,1065748,1066572,1067166,1068192,1068592,1071063,1071499,1071630,1071958,1072512,1072539,1073029,1073290,1077219,1079239,1079653,1080126,1080135,1080216,1080612,1080864,1081206,1081260,1081350,1081399,1082160,1083285,1083537,1083942,1086012,1086120,1086129,1088640,1088964,1089612,1089913,1090525,1091299,1092816,1095025,1095250,1095295,1098238,1098522,1099525,1104264,1104966,1106424,1106428,1107580,1109295,1113385,1114852,1116684,1116846,1118466,1118736,1123632,1124199,1124680,1124689,1125009,1125090,1125900,1130436,1131448,1134486,1134688,1136268,1137339,1137393,1137933,1138986,1139125,1139229,1140862,1140885,1142680,1144786,1147923,1148175,1150677,1152027,1152225,1152549,1152837,1155996,1156428,1156720,1156833,1156990,1160725,1160995,1163484,1163974,1164096,1164780,1164960,1167250,1167259,1167714,1169280,1169478,1169496,1170670,1172682,1175625,1176039,1176754,1177254,1177384,1178248,1178464,1178635,1179603,1179616,1180242,1181565,1182537,1184008,1184080,1184400,1184625,1184800,1185075,1185678,1185750,1186528,1186992,1187455,1188265,1189206,1189260,1192045,1192554,1193017,1193283,1194831,1195236,1196496,1198408,1198476,1198480,1198575,1198926,1199848,1200006,1200060,1200384,1200600,1200762,1200843,1201086,1201815,1202355,1203084,1203651,1203840,1203894,1204168,1205406,1205482,1205595,1205685,1206000,1206108,1206814,1207620,1207714,1208196,1208403,1208430,1208943,1209541,1209564,1209735,1210806,1210860,1215180,1215760,1215972,1216894,1216948,1218015,1218150,1219576,1225462,1226745,1227460,1227640,1227694,1229548,1229674,1230084,1230840,1230894,1232896,1233540,1234768,1234876,1235038,1235380,1236384,1236726,1236748,1236874,1237369,1237468,1237486,1238400,1238584,1238940,1238994,1240537,1240677,1240843,1241284,1243584,1244502,1244830,1244880,1245208,1245420,1245964,1246396,1247958,1248876,1249528,1249668,1249780,1250005,1250050,1250095,1250496,1250500,1250950,1250964,1250995,1252480,1253065,1253632,1254330,1254600,1254748,1255000,1255005,1255729,1255810,1256436,1256490,1256530,1256827,1258816,1259473,1259500,1259649,1259793,1259950,1259995,1260000,1260108,1260270,1261080,1261399,1261885,1262079,1263456,1263604,1263748,1264086,1264536,1265305,1265530,1268316,1268374,1268460,1269342,1269774,1270647,1270948,1271943,1274170,1274368,1274665,1274836,1274872,1275264,1275286,1275925,1276065,1276200,1276348,1276524,1276834,1279642,1280524,1281582,1282716,1283166,1283359,1283476,1283544,1283674,1283746,1284003,1284030,1284300,1284435,1285384,1285915,1286374,1286608,1286968,1287436,1287634,1288354,1289376,1289403,1289430,1289943,1290564,1291234,1291675,1292458,1292746,1294380,1294519,1295005,1295014,1295050,1295095,1295140,1295500,1295640,1295644,1295694,1295950,1295964,1295995,1296400,1296648,1297611,1297750,1298475,1298632,1299505,1299550,1299595,1299955,1302448,1302565,1302655,1302714,1303438,1304118,1305265,1306246,1306278,1306525,1307826,1312420,1312542,1312726,1314895,1318648,1320241,1320475,1320493,1320867,1322046,1322455,1324125,1324300,1324584,1324854,1324917,1325065,1325650,1325695,1325776,1325965,1326150,1326204,1326415,1326505,1326550,1326595,1326717,1326955,1328445,1329565,1329655,1332450,1335442,1336176,1338246,1338768,1339416,1340163,1341027,1341274,1342750,1342768,1342876,1345360,1347250,1347628,1347682,1348276,1348285,1348762,1348974,1348996,1349023,1350045,1350450,1352286,1352416,1352457,1352664,1352929,1354284,1354288,1354500,1356376,1356498,1357398,1357884,1357924,1358280,1358370,1358442,1360435,1361785,1362438,1362748,1362874,1365250,1367428,1367482,1368054,1368274,1368432,1368540,1368594,1368742,1369480,1369732,1371784,1373071,1374268,1374286,1374628,1374682,1374826,1374862,1375479,1379128,1379448,1380645,1381743,1386571,1387840,1387984,1388178,1392435,1395000,1395648,1396782,1397281,1398240,1400035,1400350,1401696,1402533,1402695,1402978,1403500,1406137,1409278,1409782,1413045,1413445,1413450,1413472,1417437,1418679,1418976,1419165,1420978,1423318,1425375,1425753,1426225,1427368,1427899,1428736,1429780,1429798,1429978,1430941,1432768,1432876,1434069,1435000,1435036,1436472,1436526,1436728,1436872,1437039,1437093,1437268,1437286,1437309,1437390,1437520,1437903,1437930,1439059,1439739,1439793,1443096,1443906,1448392,1452343,1452730,1452888,1453140,1453450,1455970,1456798,1456803,1456830,1458810,1458828,1458832,1459354,1461370,1462072,1463728,1465200,1465290,1465870,1468372,1468953,1469520,1470568,1471365,1472368,1472836,1473628,1473664,1473678,1473682,1473934,1475266,1475635,1476328,1476688,1476832,1480279,1482138,1482736,1483276,1483672,1483726,1484892,1486372,1487236,1487286,1487362,1487632,1489752,1492456,1492632,1493640,1493739,1493793,1493964,1495683,1495786,1497366,1497802,1497820,1497982,1498032,1498783,1499782,1500003,1500030,1500246,1500300,1500435,1500624,1502406,1502460,1502946,1503000,1504350,1506024,1506240,1506294,1506325,1506523,1507968,1508026,1508260,1510267,1510533,1512396,1518264,1519978,1520365,1520608,1520766,1522710,1523277,1524006,1524060,1524339,1524600,1524762,1524978,1525630,1526080,1526287,1526305,1526850,1529325,1529406,1529460,1529946,1530000,1530054,1530625,1531053,1532389,1532560,1532605,1532776,1533105,1534360,1537263,1537425,1538181,1538433,1538964,1541938,1542343,1542496,1543284,1543500,1543716,1547334,1548738,1552630,1552770,1553260,1553269,1553409,1558228,1558426,1560024,1560240,1560325,1562224,1562346,1562400,1562530,1562890,1563025,1563048,1563250,1563264,1563295,1563507,1565329,1568484,1569150,1570392,1572925,1574253,1576827,1579419,1579486,1579500,1579648,1581268,1581930,1583145,1583865,1584432,1585390,1586245,1586304,1587820,1588158,1590435,1590835,1591884,1592419,1594138,1596325,1597725,1599426,1601626,1603255,1605208,1605325,1608246,1608520,1608624,1613538,1614235,1614262,1615374,1615833,1620072,1620720,1624338,1624536,1625026,1625260,1625305,1625476,1625530,1626322,1627200,1627348,1627524,1627632,1627857,1628734,1629396,1629576,1629760,1630255,1630287,1630525,1632505,1632550,1632595,1632708,1632748,1632874,1632955,1633545,1634728,1634872,1637950,1638054,1638540,1638594,1639440,1642356,1642455,1643292,1645312,1645735,1645803,1645830,1645839,1647436,1647828,1648732,1649583,1652008,1652080,1652472,1652584,1657062,1662039,1664892,1667952,1672348,1672398,1672528,1672834,1672884,1672965,1673257,1673428,1673482,1673752,1674328,1674832,1675728,1677672,1679458,1680520,1682032,1682608,1682734,1683274,1683346,1683472,1685200,1687149,1687234,1687342,1687432,1687950,1688328,1691865,1693237,1693795,1695537,1698327,1698412,1698642,1698750,1699137,1702345,1702624,1704312,1704339,1712434,1713649,1715098,1715980,1716975,1717699,1718248,1722460,1723036,1723468,1723486,1723698,1723806,1723860,1723927,1724184,1724886,1726348,1726834,1726884,1727896,1728220,1728342,1728346,1728634,1732153,1732414,1732500,1734129,1734268,1734286,1734628,1734682,1734826,1734862,1739128,1739250,1739925,1740028,1740082,1740208,1740235,1740280,1740298,1740802,1740820,1740982,1742008,1742080,1742098,1742800,1742958,1742980,1742998,1743268,1743286,1743700,1743997,1746328,1746832,1747039,1747930,1748002,1748020,1748200,1748326,1748632,1749802,1749820,1749982,1750432,1753290,1755918,1756890,1758393,1759198,1760535,1762069,1762150,1762384,1765273,1768248,1772941,1775038,1779975,1780294,1780942,1782094,1782562,1782940,1782994,1783584,1784695,1785204,1785726,1789402,1789420,1789942,1790995,1792386,1793250,1793925,1794028,1794082,1794208,1794280,1794298,1794802,1794820,1794883,1794982,1795680,1798294,1798942,1799325,1799428,1799482,1800225,1802250,1802727,1802970,1802974,1804288,1806021,1806210,1807029,1809702,1809742,1812636,1813747,1815835,1820065,1820227,1820650,1820763,1820875,1820974,1822500,1823845,1823976,1824732,1825416,1826055,1826500,1826892,1827000,1828075,1828701,1829079,1829740,1829794,1829974,1831752,1834128,1835046,1835644,1839744,1839852,1841260,1847286,1851988,1852384,1854832,1854972,1856272,1856277,1858212,1861249,1863504,1866240,1867216,1867536,1870209,1870290,1871428,1873264,1874520,1879195,1879326,1882435,1887291,1890265,1890702,1893258,1895364,1897020,1897213,1897402,1897420,1897942,1899742,1900521,1902109,1902465,1902600,1902775,1904274,1904728,1905025,1908270,1908324,1908522,1909026,1909215,1912050,1912806,1913886,1914129,1915893,1917958,1919232,1920235,1920285,1920555,1920919,1921500,1923628,1923750,1925658,1925896,1926504,1926850,1927062,1927170,1928115,1929816,1932417,1932570,1934946,1935220,1935756,1937592,1937848,1938321,1939450,1942290,1942978,1946853,1949782,1950835,1956325,1962675,1963255,1965433,1965537,1965820,1966288,1967238,1968219,1973826,1974028,1974082,1974208,1974280,1974298,1974802,1974820,1974982,1977250,1978294,1978942,1979428,1979482,1979725,1979802,1980252,1982061,1982974,1984248,1985328,1989742,1994265,1997428,1997482};

int main(){
	ll u;
	s.clear();
	for(ll i=0;i<1783;i++)s.insert(ans[i]);
	while(cin>>u, u)
		cout<<(*s.lower_bound(u))<<endl;
	return 0;
}

HDU 4325 Vampire Numbers 打表

时间: 2024-10-27 07:31:03

HDU 4325 Vampire Numbers 打表的相关文章

HDU 3117 Fibonacci Numbers(斐波那契前后四位,打表+取对+矩阵快速幂)

HDU 3117 Fibonacci Numbers(斐波那契前后四位,打表+取对+矩阵快速幂) ACM 题目地址:HDU 3117 Fibonacci Numbers 题意: 求第n个斐波那契数的前四位和后四位. 不足8位直接输出. 分析: 前四位有另外一题HDU 1568,用取对的方法来做的. 后四位可以用矩阵快速幂,MOD设成10000就行了. 代码: /* * Author: illuz <iilluzen[at]gmail.com> * Blog: http://blog.csdn.

HDU 1058 Humble Numbers (dp+打表)

先是想筛法素数表啊,然后1~2000000000枚举打表啊,结果越想越不对. 后来想到唯一分解定理,可是怎么实现呢..果然还是需要努力啊.. 研究了discuss代码,码之~ ~~~~ dp的思想,若dp[i]是Humble Numbers,那么dp[i]*2,dp[i]*3,dp[i]*5,dp[i]*7都将是Humble Numbers. 所以只需要注意连续性便好了. #include<cstdio> #include<algorithm> #include<cmath&

HDU 1058 Humble Numbers (打表)

题目链接:HDU 1058 Humble Numbers 题意:一些数他们的素数因子只有2,3,5,7.求这些数. 因为这些数的因子只可能是2,3,5,7.所以通过2,3,5,7这个四个数构造这个数列,这个数列靠后的数必定是前面的数乘上2,3,5,7得到. AC代码: #include<stdio.h> #include<set> #define ll __int64 using namespace std; set<ll> s; set<ll>::iter

hdu 3117 Fibonacci Numbers

点击此处即可传送到hdu 3117 **Fibonacci Numbers** Problem Description The Fibonacci sequence is the sequence of numbers such that every element is equal to the sum of the two previous elements, except for the first two elements f0 and f1 which are respectively

hdu 4722 Good Numbers(dp)

public static void main(String[] args) { String a=null; if("aa".equals(a))//这种情形,不出现空指针异常 //if(a.equals("aa"))//出现空指针异常 { System.out.println(true); } else { System.out.println(false); } } 上面的两句不同的比较语句测试,第一句不出现空指针异常,第二句出现. 所以在变量和常量比较的时候

HDU 4858 项目管理(邻接表 暴力模拟)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4858 我们建造了一个大项目!这个项目有n个节点,用很多边连接起来,并且这个项目是连通的! 两个节点间可能有多条边,不过一条边的两端必然是不同的节点.每个节点都有一个能量值. 现在我们要编写一个项目管理软件,这个软件呢有两个操作:1.给某个项目的能量值加上一个特定值.2.询问跟一个项目相邻的项目的能量值之和.(如果有多条边就算多次,比如a和b有2条边,那么询问a的时候b的权值算2次). 解题报告:这个

UVA 11582 Colossal Fibonacci Numbers!(打表+快速幂)

Colossal Fibonacci Numbers! The i'th Fibonacci number f (i) is recursively defined in the following way: f (0) = 0 and f (1) = 1 f (i+2) = f (i+1) + f (i)  for every i ≥ 0 Your task is to compute some values of this sequence. Input begins with an int

HDU 4952 Number Transformation 打表规律

点击打开链接 Number Transformation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 495    Accepted Submission(s): 248 Problem Description Teacher Mai has an integer x. He does the following operation

HDU 4961 Boring Sum 打表、更新

点击打开链接 Boring Sum Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 715    Accepted Submission(s): 351 Problem Description Number theory is interesting, while this problem is boring. Here is th