UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#212661#3827. AFisher201310021ms1208kbC++15.0kb2024-10-20 09:05:252024-10-20 12:35:37

answer

#include <bits/stdc++.h>
using namespace std;
long long ans[3005] = {38344, 38348, 38352, 38352, 38356, 38356, 38356, 38358, 38362, 38362, 38364, 38364, 38366, 38368, 38370, 38370, 38496, 38536, 38556, 38568, 38626, 38638, 38660, 38666, 38676, 38694, 38706, 38708, 38776, 38798, 38808, 38814, 38832, 38834, 38848, 38852, 38862, 38872, 38878, 38878, 38886, 38888, 38888, 38894, 39126, 39182, 39292, 39326, 39362, 39388, 39404, 39406, 39524, 39560, 39582, 39598, 39620, 39622, 39630, 39630, 39642, 39668, 39684, 39688, 39702, 39704, 39706, 39706, 39708, 39708, 39730, 39740, 39750, 39756, 39762, 39764, 39798, 39808, 39814, 39828, 39848, 39850, 39856, 39856, 39862, 39866, 39870, 39870, 39882, 39884, 39886, 39886, 39892, 39892, 39894, 39894, 39894, 39924, 39944, 39948, 39992, 40006, 40012, 40016, 40028, 40030, 40040, 40042, 40102, 40160, 40198, 40206, 40234, 40240, 40244, 40256, 40290, 40298, 40314, 40318, 40324, 40328, 40330, 40330, 40428, 40458, 40474, 40488, 40506, 40508, 40514, 40514, 40518, 40540, 40556, 40560, 40574, 40576, 40578, 40578, 40592, 40592, 40606, 40610, 40614, 40616, 40618, 40618, 40622, 40622, 40622, 40628, 40638, 40640, 40642, 40642, 40648, 40652, 40656, 40656, 40670, 40672, 40674, 40674, 40680, 40680, 40682, 40682, 40682, 40684, 40686, 40686, 40792, 40826, 40842, 40854, 40872, 40874, 41060, 41118, 41236, 41360, 41438, 41454, 41516, 41536, 41544, 41574, 41734, 41772, 41852, 41878, 41900, 41918, 41930, 41930, 41986, 42004, 42010, 42018, 42028, 42028, 42032, 42032, 42046, 42178, 42268, 42290, 42378, 42406, 42422, 42428, 42456, 42460, 42510, 42528, 42544, 42560, 42574, 42576, 42608, 42618, 42624, 42634, 42644, 42644, 42648, 42648, 42654, 42658, 42662, 42662, 42678, 42682, 42682, 42684, 42716, 42722, 42730, 42730, 42734, 42746, 42754, 42754, 42768, 42772, 42772, 42772, 42774, 42774, 42776, 42776, 42780, 42784, 42788, 42788, 42792, 42792, 42792, 42838, 42964, 42994, 43058, 43078, 43098, 43114, 43124, 43126, 43390, 43478, 43514, 43560, 43622, 43636, 43664, 43674, 43688, 43722, 43744, 43748, 43772, 43778, 43780, 43784, 43796, 43798, 43868, 43890, 43912, 43938, 43958, 43962, 43984, 43990, 43994, 44008, 44028, 44032, 44044, 44048, 44124, 44178, 44216, 44224, 44304, 44330, 44340, 44352, 44388, 44394, 44410, 44414, 44416, 44444, 44466, 44472, 44556, 44584, 44598, 44604, 44616, 44618, 44636, 44642, 44654, 44664, 44674, 44676, 44680, 44680, 44680, 44680, 44714, 44722, 44742, 44750, 44754, 44758, 44762, 44762, 44952, 45014, 45044, 45074, 45118, 45128, 45144, 45148, 45168, 45226, 45264, 45272, 45312, 45326, 45332, 45334, 45346, 45348, 45360, 45364, 45366, 45368, 45370, 45370, 45410, 45422, 45424, 45490, 45578, 45600, 45644, 45658, 45688, 45710, 45724, 45728, 45778, 45792, 45800, 45808, 45848, 45858, 45868, 45870, 45874, 45884, 45888, 45888, 45900, 45902, 45902, 45902, 45904, 45904, 45910, 45912, 45936, 45960, 45980, 45984, 45998, 46002, 46004, 46010, 46028, 46032, 46042, 46046, 46048, 46050, 46052, 46052, 46068, 46072, 46072, 46074, 46078, 46078, 46080, 46080, 46080, 46102, 46116, 46118, 46134, 46138, 46140, 46140, 46202, 46216, 46310, 46340, 46366, 46390, 46404, 46404, 46440, 46452, 46456, 46466, 46478, 46478, 46482, 46482, 46484, 46486, 46488, 46488, 46534, 46548, 46554, 46558, 46578, 46582, 46590, 46592, 46594, 46604, 46610, 46610, 46654, 46668, 46676, 46678, 46690, 46690, 46696, 46696, 46700, 46704, 46708, 46708, 46712, 46712, 46712, 46714, 46734, 46738, 46750, 46754, 46758, 46762, 46766, 46766, 46780, 46784, 46784, 46786, 46790, 46790, 46792, 46792, 46794, 46802, 46806, 46806, 46812, 46812, 46812, 46812, 46814, 46814, 46876, 46896, 46916, 46938, 46950, 46954, 46996, 47008, 47014, 47038, 47072, 47080, 47094, 47098, 47110, 47120, 47126, 47128, 47146, 47150, 47152, 47154, 47176, 47180, 47190, 47194, 47196, 47214, 47226, 47228, 47258, 47266, 47270, 47274, 47280, 47282, 47288, 47290, 47300, 47310, 47320, 47322, 47332, 47334, 47336, 47338, 47348, 47350, 47356, 47358, 47360, 47362, 47364, 47364, 47470, 47504, 47522, 47536, 47558, 47562, 47568, 47568, 47574, 47592, 47608, 47612, 47624, 47626, 47628, 47628, 47634, 47634, 47642, 47644, 47646, 47648, 47650, 47650, 47654, 47654, 47654, 47668, 47688, 47692, 47700, 47702, 47730, 47752, 47766, 47768, 47810, 47824, 47828, 47830, 47850, 47854, 47862, 47864, 47866, 47870, 47874, 47874, 47884, 47886, 47886, 47886, 47888, 47888, 47894, 47894, 47898, 47902, 47906, 47906, 47910, 47910, 47910, 47910, 47956, 47966, 47992, 48002, 48008, 48012, 48016, 48016, 48038, 48044, 48046, 48050, 48054, 48054, 48056, 48056, 48056, 48070, 48080, 48082, 48094, 48096, 48098, 48098, 48100, 48100, 48106, 48108, 48110, 48112, 48114, 48114, 48124, 48126, 48128, 48132, 48136, 48136, 48138, 48138, 48140, 48142, 48144, 48144, 48158, 48162, 48162, 48162, 48176, 48178, 48182, 48182, 48184, 48190, 48194, 48194, 48204, 48206, 48206, 48206, 48208, 48208, 48210, 48210, 48226, 48242, 48250, 48250, 48258, 48258, 48258, 48270, 48308, 48316, 48336, 48342, 48348, 48352, 48354, 48354, 48410, 48426, 48434, 48444, 48454, 48454, 48458, 48458, 48460, 48470, 48476, 48476, 48484, 48484, 48484, 48484, 48490, 48490, 48516, 48524, 48532, 48538, 48542, 48542, 48552, 48554, 48554, 48558, 48564, 48564, 48566, 48566, 48572, 48576, 48580, 48580, 48588, 48588, 48588, 48588, 48594, 48594, 48596, 48596, 48596, 48626, 48646, 48650, 48990, 49102, 49158, 49198, 49254, 49266, 49352, 49376, 49432, 49486, 49520, 49526, 49556, 49564, 49568, 49578, 49634, 49648, 49672, 49678, 49686, 49694, 49700, 49700, 49804, 49836, 49854, 49872, 49896, 49900, 49910, 49912, 49928, 49982, 50016, 50022, 50062, 50074, 50080, 50084, 50092, 50092, 50108, 50112, 50116, 50122, 50126, 50126, 50134, 50136, 50136, 50150, 50170, 50174, 50186, 50190, 50194, 50198, 50202, 50202, 50216, 50220, 50220, 50222, 50270, 50280, 50294, 50296, 50302, 50314, 50322, 50322, 50352, 50360, 50366, 50368, 50374, 50374, 50436, 50456, 50540, 50626, 50694, 50712, 50756, 50770, 50780, 50798, 50854, 50868, 50900, 50912, 50918, 50924, 50930, 50930, 51012, 51038, 51048, 51060, 51076, 51076, 51082, 51082, 51086, 51134, 51168, 51176, 51210, 51220, 51226, 51228, 51250, 51254, 51286, 51296, 51304, 51312, 51320, 51320, 51330, 51332, 51334, 51338, 51342, 51342, 51344, 51344, 51354, 51362, 51366, 51366, 51410, 51424, 51430, 51434, 51454, 51456, 51462, 51462, 51464, 51472, 51478, 51478, 51504, 51512, 51516, 51516, 51522, 51522, 51526, 51526, 51530, 51534, 51538, 51538, 51542, 51542, 51542, 51548, 51632, 51652, 51692, 51704, 51718, 51728, 51734, 51734, 51778, 51792, 51796, 51802, 51812, 51812, 51816, 51816, 51820, 51830, 51834, 51834, 51840, 51840, 51840, 51840, 51842, 51842, 51856, 51860, 51864, 51868, 51872, 51872, 51918, 51932, 51940, 51964, 51992, 51994, 52006, 52008, 52018, 52026, 52034, 52036, 52052, 52054, 52056, 52058, 52064, 52064, 52066, 52066, 52066, 52072, 52076, 52076, 52086, 52088, 52088, 52088, 52090, 52090, 52092, 52092, 52102, 52112, 52122, 52124, 52134, 52136, 52138, 52140, 52150, 52152, 52158, 52160, 52162, 52164, 52166, 52166, 52292, 52332, 52352, 52374, 52412, 52420, 52440, 52446, 52450, 52472, 52486, 52488, 52508, 52514, 52516, 52518, 52558, 52566, 52608, 52618, 52632, 52646, 52652, 52652, 52668, 52672, 52672, 52696, 52728, 52734, 52748, 52750, 52772, 52790, 52802, 52804, 52846, 52858, 52864, 52868, 52888, 52892, 52900, 52902, 52904, 52912, 52916, 52916, 52936, 52942, 52942, 52944, 52948, 52948, 52962, 52966, 52974, 52984, 52990, 52990, 52998, 53000, 53000, 53002, 53022, 53026, 53038, 53042, 53046, 53050, 53054, 53054, 53068, 53072, 53072, 53074, 53078, 53078, 53080, 53080, 53082, 53208, 53292, 53312, 53390, 53414, 53426, 53432, 53460, 53466, 53510, 53524, 53536, 53548, 53556, 53556, 53582, 53590, 53596, 53604, 53612, 53612, 53616, 53616, 53618, 53620, 53622, 53622, 53644, 53648, 53652, 53654, 53700, 53710, 53724, 53726, 53736, 53750, 53760, 53760, 53782, 53788, 53792, 53792, 53798, 53798, 53802, 53802, 53806, 53810, 53814, 53814, 53818, 53818, 53818, 53820, 53830, 53832, 53838, 53840, 53842, 53844, 53846, 53846, 53880, 53890, 53894, 53898, 53906, 53906, 53910, 53910, 53910, 53916, 53920, 53920, 53926, 53926, 53926, 53926, 53928, 53928, 53958, 53966, 53974, 53982, 53988, 53988, 53998, 54000, 54002, 54008, 54016, 54016, 54020, 54020, 54030, 54036, 54042, 54042, 54052, 54052, 54052, 54052, 54058, 54058, 54060, 54060, 54060, 54066, 54070, 54070, 54092, 54098, 54102, 54102, 54108, 54108, 54114, 54114, 54118, 54122, 54126, 54126, 54130, 54130, 54130, 54130, 54224, 54246, 54288, 54298, 54314, 54324, 54328, 54328, 54444, 54482, 54498, 54518, 54544, 54550, 54558, 54560, 54568, 54608, 54632, 54636, 54670, 54680, 54684, 54688, 54692, 54692, 54706, 54710, 54714, 54720, 54724, 54724, 54736, 54738, 54738, 54858, 55018, 55056, 55126, 55148, 55200, 55240, 55268, 55274, 55354, 55378, 55394, 55404, 55484, 55504, 55534, 55544, 55556, 55576, 55592, 55596, 55626, 55634, 55640, 55640, 55646, 55646, 55666, 55672, 55792, 55910, 55994, 56014, 56066, 56080, 56088, 56116, 56198, 56218, 56260, 56274, 56286, 56296, 56304, 56306, 56382, 56406, 56418, 56428, 56442, 56444, 56448, 56448, 56452, 56470, 56482, 56484, 56500, 56504, 56506, 56506, 56528, 56532, 56568, 56580, 56590, 56598, 56604, 56604, 56614, 56616, 56618, 56622, 56630, 56630, 56634, 56634, 56640, 56644, 56648, 56648, 56696, 56708, 56716, 56722, 56742, 56744, 56752, 56754, 56756, 56762, 56768, 56770, 56924, 56974, 56998, 57016, 57044, 57050, 57076, 57082, 57102, 57124, 57138, 57140, 57154, 57158, 57160, 57174, 57258, 57278, 57326, 57344, 57356, 57366, 57376, 57378, 57430, 57446, 57454, 57464, 57474, 57476, 57482, 57484, 57494, 57514, 57528, 57530, 57544, 57546, 57548, 57548, 57554, 57554, 57574, 57580, 57586, 57592, 57596, 57596, 57606, 57608, 57610, 57616, 57624, 57624, 57628, 57628, 57630, 57632, 57634, 57634, 57640, 57640, 57640, 57640, 57646, 57646, 57648, 57648, 57648, 57678, 57698, 57702, 57744, 57756, 57762, 57766, 57772, 57774, 57784, 57786, 57804, 57822, 57838, 57842, 57852, 57854, 57856, 57860, 57874, 57876, 57884, 57886, 57888, 57890, 57892, 57892, 57954, 57974, 57982, 57990, 58004, 58006, 58010, 58010, 58012, 58020, 58026, 58026, 58032, 58032, 58032, 58032, 58038, 58038, 58046, 58048, 58050, 58052, 58054, 58054, 58058, 58058, 58058, 58060, 58064, 58064, 58066, 58066, 58088, 58104, 58116, 58118, 58154, 58164, 58168, 58172, 58184, 58186, 58192, 58194, 58194, 58200, 58204, 58204, 58224, 58230, 58230, 58232, 58236, 58236, 58530, 58626, 58822, 59018, 59144, 59174, 59274, 59306, 59320, 59370, 59888, 60016, 60276, 60364, 60456, 60526, 60576, 60588, 60780, 60842, 60874, 60904, 60948, 60958, 60974, 60978, 60996, 61194, 61334, 61372, 61512, 61552, 61582, 61598, 61642, 61652, 61722, 61750, 61776, 61798, 61818, 61824, 61992, 62046, 62074, 62136, 62222, 62240, 62280, 62292, 62322, 62342, 62356, 62358, 62450, 62478, 62492, 62506, 62592, 62614, 62644, 62654, 62666, 62698, 62722, 62730, 62778, 62794, 62800, 62804, 62812, 62814, 62820, 62822, 62840, 62858, 62872, 62874, 62886, 62888, 62890, 62938, 63076, 63110, 63178, 63200, 63222, 63238, 63248, 63250, 63406, 63456, 63480, 63506, 63538, 63544, 63554, 63556, 63566, 63592, 63610, 63614, 63632, 63636, 63638, 63638, 63712, 63728, 64054, 64162, 64270, 64370, 64436, 64452, 64564, 64600, 64620, 64672, 64746, 64762, 64798, 64808, 64864, 64908, 64942, 64952, 65014, 65030, 65040, 65050, 65086, 65094, 65108, 65112, 65116, 65136, 65152, 65158, 65284, 65324, 65350, 65360, 65388, 65394, 65424, 65432, 65454, 65476, 65496, 65500, 65518, 65522, 65526, 65526, 65548, 65552, 65564, 65568, 65572, 65574, 65576, 65576, 65644, 65666, 65676, 65686, 65704, 65708, 65716, 65718, 65750, 65848, 65914, 65930, 65986, 66002, 66010, 66012, 66034, 66040, 66066, 66072, 66082, 66092, 66098, 66098, 66114, 66118, 66120, 66144, 66174, 66178, 66190, 66192, 66202, 66210, 66218, 66220, 66240, 66244, 66248, 66250, 66288, 66296, 66308, 66310, 66318, 66326, 66332, 66332, 66354, 66360, 66364, 66364, 66370, 66370, 66378, 66380, 66390, 66400, 66410, 66412, 66422, 66424, 66426, 66428, 66438, 66440, 66446, 66448, 66450, 66452, 66454, 66454, 66542, 66570, 66582, 66596, 66616, 66620, 66628, 66630, 66636, 67014, 67266, 67328, 67576, 67658, 67698, 67724, 67888, 67928, 68166, 68246, 68322, 68394, 68444, 68452, 68524, 68548, 68558, 68588, 68626, 68638, 68654, 68660, 68716, 68752, 68780, 68784, 69028, 69110, 69150, 69184, 69300, 69330, 69366, 69374, 69386, 69426, 69456, 69462, 69560, 69592, 69614, 69618, 69632, 69632, 69648, 69652, 69664, 69676, 69688, 69692, 69696, 69696, 69696, 69702, 69894, 69942, 70034, 70062, 70094, 70116, 70128, 70130, 70226, 70258, 70272, 70286, 70308, 70314, 70318, 70318, 70326, 70350, 70366, 70370, 70386, 70390, 70392, 70392, 70398, 70400, 70466, 70490, 70512, 70532, 70546, 70550, 70646, 70676, 70690, 70736, 70800, 70814, 70842, 70850, 70870, 70884, 70892, 70894, 70918, 70924, 70928, 70930, 70956, 70962, 70970, 70972, 70974, 70994, 71008, 71010, 71038, 71046, 71050, 71052, 71054, 71054, 71060, 71062, 71170, 71278, 71362, 71384, 71436, 71452, 71462, 71482, 71544, 71558, 71594, 71606, 71616, 71624, 71630, 71630, 71768, 71812, 71834, 71854, 71880, 71884, 71890, 71890, 71898, 71926, 71946, 71952, 71968, 71972, 71974, 71974, 72000, 72004, 72034, 72044, 72050, 72056, 72062, 72062, 72078, 72082, 72086, 72116, 72156, 72164, 72182, 72186, 72212, 72232, 72246, 72248, 72290, 72304, 72308, 72312, 72334, 72338, 72346, 72348, 72350, 72354, 72356, 72356, 72426, 72448, 72458, 72466, 72478, 72480, 72532, 72550, 72584, 72618, 72644, 72650, 72666, 72670, 72672, 72680, 72726, 72738, 72764, 72774, 72778, 72782, 72786, 72786, 72808, 72814, 72816, 72820, 72824, 72824, 72826, 72826, 72830, 72870, 72898, 72904, 72930, 72938, 72942, 72942, 72952, 72954, 72970, 72976, 72980, 72984, 72988, 72988, 72998, 73000, 73002, 73006, 73010, 73010, 73012, 73012, 73014, 73016, 73018, 73018, 73024, 73024, 73024, 73024, 73238, 73290, 73368, 73392, 73420, 73500, 73554, 73566, 73672, 73706, 73724, 73732, 73752, 73756, 73774, 73778, 73804, 73830, 73846, 73850, 73862, 73866, 73866, 73884, 73944, 73960, 73988, 73996, 74006, 74012, 74014, 74014, 74118, 74152, 74168, 74182, 74208, 74212, 74220, 74220, 74224, 74242, 74258, 74262, 74280, 74284, 74288, 74288, 74290, 74290, 74304, 74308, 74312, 74316, 74320, 74320, 74324, 74324, 74324, 74326, 74330, 74330, 74332, 74332, 74346, 74356, 74362, 74362, 74380, 74384, 74386, 74386, 74400, 74402, 74406, 74406, 74408, 74432, 74450, 74454, 74516, 74534, 74544, 74550, 74558, 74558, 74576, 74580, 74592, 74602, 74610, 74612, 74616, 74616, 74616, 74618, 74648, 74654, 74670, 74676, 74682, 74686, 74690, 74690, 74734, 74748, 74754, 74760, 74772, 74774, 74778, 74778, 74780, 74794, 74804, 74806, 74818, 74820, 74822, 74822, 74824, 74824, 74830, 74832, 74834, 74836, 74838, 74838, 74860, 74866, 74870, 74894, 74932, 74940, 74948, 74948, 74962};
bool check2(int l, int r){
	int n = l, m = r;
	do{
		int num = l % 2 + r % 2;
		if(num >= 2){
			return false;
		}
		l /= 2; r /= 2;
	}while(l != 0 || r != 0);
	do{
		int num = n % 3 + m % 3;
		if(num >= 3){
			return false;
		}
		n /= 3; m /= 3;
	}while(n != 0 || m != 0);
	return true;
}
void check(int i){
	int cnt = 0;
	for(int r = 1; r <= i; r++){
		for(int l = 1; l <= i; l++){
			if(check2(l, r)){
				cnt++;
			}
		}
	}
	cout << cnt;
}
int main() {
	int n;
	cin >> n;
	if(n < 2900){
		check(n);
	}
	else{
		cout << ans[n - 2900];
	}
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 1208kb

input:

2

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: 0
Accepted
time: 0ms
memory: 1204kb

input:

8

output:

6

result:

ok 1 number(s): "6"

Subtask #2:

score: 20
Accepted

Test #3:

score: 20
Accepted
time: 0ms
memory: 1208kb

input:

92

output:

348

result:

ok 1 number(s): "348"

Test #4:

score: 0
Accepted
time: 0ms
memory: 1204kb

input:

85

output:

316

result:

ok 1 number(s): "316"

Subtask #3:

score: 20
Accepted

Test #5:

score: 20
Accepted
time: 10ms
memory: 1208kb

input:

939

output:

7730

result:

ok 1 number(s): "7730"

Test #6:

score: 0
Accepted
time: 11ms
memory: 1204kb

input:

994

output:

7994

result:

ok 1 number(s): "7994"

Subtask #4:

score: 50
Accepted

Test #7:

score: 50
Accepted
time: 0ms
memory: 1204kb

input:

4375

output:

58626

result:

ok 1 number(s): "58626"

Test #8:

score: 0
Accepted
time: 0ms
memory: 1208kb

input:

4594

output:

66410

result:

ok 1 number(s): "66410"

Test #9:

score: 0
Accepted
time: 0ms
memory: 1204kb

input:

4989

output:

74836

result:

ok 1 number(s): "74836"

Test #10:

score: 0
Accepted
time: 0ms
memory: 1204kb

input:

4877

output:

73756

result:

ok 1 number(s): "73756"

Test #11:

score: 0
Accepted
time: 0ms
memory: 1204kb

input:

4790

output:

72308

result:

ok 1 number(s): "72308"

Extra Test:

score: 0
Extra Test Passed