#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct st{
int d, i;
st(){}
st(int d) : d(d), i(1) {}
};
void getd(int n, vector<st> &d){
for(int i = 2; i*i <= n; ++i){
while(n%i==0){
if(d.size() && d.back().d == i) ++d.back().i;
else d.emplace_back(st(i));
n /= i;
}
}
if(n) d.emplace_back(st(n));
}
int antyp[30] = {2,4,6,12,24,36,48,60,120,180,240,360,720,840,1260,1680,2520,5040,7560,10080,15120,20160,25200,27720,45360,50400,55440,83160,110880,166320};
unordered_map<int, set<int>> dp;
int main(){
int n;
scanf("%d", &n);
if(n==1){printf("1\n0");return 0;}
vector<st> d; getd(n, d);
set<int> s, tmp; s.emplace(1);
dp[2] = {1};
dp[4] = {2,3};
dp[6] = {3,5};
dp[12] = {4,5,6,11};
dp[24] = {5,6,7,8,9,12,23};
dp[36] = {6,7,8,10,11,13,18,35};
dp[48] = {6,7,8,9,10,12,13,14,17,24,47};
dp[60] = {8,9,10,12,14,15,16,17,21,30,59};
dp[120] = {9,10,11,12,13,14,15,16,17,18,20,21,22,24,27,31,32,41,60,119};
dp[180] = {10,11,12,14,15,16,17,18,19,20,22,23,25,26,27,32,34,39,46,47,61,90,179};
dp[240] = {10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,28,29,30,32,33,36,42,44,51,61,62,81,120,239};
dp[360] = {11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,33,34,35,36,37,40,43,44,47,48,51,62,64,75,91,92,121,180,359};
dp[720] = {12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,34,35,36,37,38,41,42,44,45,46,48,49,50,52,53,54,56,59,61,63,64,65,70,76,80,83,87,92,93,96,122,124,147,181,182,241,360,719};
dp[840] = {15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,36,37,38,39,40,41,42,43,46,47,48,51,56,57,59,60,61,66,69,72,73,74,75,80,88,92,107,108,111,125,142,144,171,211,212,281,420,839};
dp[1260] = {16,17,18,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,47,48,50,52,53,56,58,67,68,69,70,71,72,74,76,78,79,81,86,89,96,97,102,108,109,110,115,130,134,143,147,185,212,214,255,316,317,421,630,1259};
dp[1680] = {16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,57,58,60,61,62,64,66,67,68,70,73,74,75,76,77,78,80,81,84,86,87,89,90,92,93,99,102,108,109,110,112,117,119,125,126,132,143,144,145,150,172,176,212,213,216,245,282,284,339,421,422,561,840,1679};
dp[2520] = {17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,67,68,69,70,71,72,73,74,75,76,77,79,80,81,82,87,90,92,94,97,98,99,100,101,103,104,105,109,110,111,112,113,116,127,131,132,135,139,144,146,148,156,173,181,186,192,213,214,215,220,256,260,283,287,317,318,321,365,422,424,507,631,632,841,1260,2519};
dp[5040] = {18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,88,89,91,92,93,94,95,97,98,99,100,101,102,104,105,106,110,111,112,113,114,116,117,118,119,121,123,127,128,130,132,133,134,136,137,140,141,142,144,145,146,147,149,150,151,152,153,155,157,160,164,174,176,177,178,182,187,188,193,196,206,214,215,216,217,218,221,232,247,257,258,259,261,270,284,286,288,296,318,319,320,322,329,341,349,366,372,423,424,425,430,508,512,563,567,632,633,636,725,842,844,1011,1261,1262,1681,2520,5039};
dp[7560] = {19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,111,112,113,114,115,116,118,119,120,122,123,124,128,129,131,133,134,135,137,139,140,141,142,143,144,146,147,148,149,150,152,155,158,162,166,172,175,176,179,181,183,184,188,189,190,192,194,195,196,199,200,208,211,215,216,217,219,220,222,225,227,244,249,258,260,262,266,277,278,280,283,285,289,296,305,319,320,321,322,323,326,337,367,379,383,384,387,396,424,426,428,436,509,517,546,552,633,634,635,640,760,764,843,847,947,948,951,1085,1262,1264,1515,1891,1892,2521,3780,7559};
dp[10080] = {19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,122,124,128,129,130,131,132,133,134,135,136,137,138,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,158,159,160,161,164,165,169,173,175,176,177,178,179,181,182,183,184,188,189,192,194,195,197,199,200,202,204,207,210,212,215,216,217,218,219,221,222,223,226,231,233,234,235,239,248,250,254,256,258,259,260,262,263,267,271,280,285,286,287,289,290,292,297,314,319,320,321,323,324,330,342,344,345,346,350,364,367,368,373,386,424,425,426,427,428,431,442,487,499,509,510,513,522,564,566,568,576,633,634,635,637,644,677,685,726,732,843,844,845,850,1012,1016,1123,1127,1262,1263,1266,1445,1682,1684,2019,2521,2522,3361,5040,10079};
dp[15120] = {20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,161,162,163,164,166,167,168,173,176,177,178,179,180,182,184,185,186,188,189,190,191,193,195,196,197,198,200,201,202,204,207,208,209,210,212,216,217,218,219,220,221,223,224,225,226,228,229,230,232,234,244,245,246,247,249,250,253,256,259,260,261,262,263,265,266,267,268,272,278,279,280,281,282,284,285,286,288,290,292,297,298,301,306,310,320,321,322,323,324,326,327,328,331,332,338,343,347,351,361,368,370,374,379,380,384,385,388,389,397,400,416,425,426,427,429,430,432,437,441,454,465,510,512,514,518,532,547,548,553,565,566,569,585,634,635,636,637,638,641,652,727,739,761,762,765,774,844,846,848,856,948,949,950,952,959,1013,1021,1086,1092,1263,1264,1265,1270,1516,1520,1683,1687,1892,1893,1896,2165,2522,2524,3027,3781,3782,5041,7560,15119};
dp[20160] = {20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,172,174,176,177,178,179,180,181,182,183,184,185,187,188,189,190,191,193,194,195,196,198,199,200,201,202,203,205,208,209,211,213,215,216,217,218,219,220,221,222,223,224,227,229,232,234,235,236,240,242,244,249,250,251,254,255,256,257,259,260,261,262,263,264,267,268,270,272,273,281,282,284,286,287,288,289,290,291,293,294,295,298,299,302,304,312,315,320,321,322,323,324,325,328,329,330,331,332,333,341,343,344,345,346,347,349,350,351,352,356,365,368,369,372,374,375,377,381,387,394,414,425,426,427,428,429,431,432,433,436,443,455,459,463,466,488,490,491,494,500,510,511,514,515,520,523,542,565,566,567,569,570,572,577,585,594,609,634,635,636,638,639,645,660,678,680,682,686,700,727,728,733,746,844,845,846,847,848,851,862,967,979,1013,1014,1017,1026,1124,1126,1128,1136,1263,1264,1265,1267,1274,1349,1357,1446,1452,1683,1684,1685,1690,2020,2024,2243,2247,2522,2523,2526,2885,3362,3364,4035,5041,5042,6721,10080,20159};
dp[25200] = {22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,143,144,145,146,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,171,172,173,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,202,204,206,210,211,212,214,215,216,218,219,220,221,222,223,224,225,226,227,229,230,231,233,234,235,236,238,240,241,242,244,245,246,249,250,251,253,254,259,261,262,263,265,269,274,275,277,278,280,288,290,292,296,298,300,301,309,310,311,315,316,317,318,321,322,323,324,326,327,328,330,333,335,336,341,343,345,350,353,354,356,357,358,359,360,361,363,364,365,368,369,370,374,376,382,385,393,394,409,413,420,421,427,428,429,431,433,434,435,436,440,449,458,459,461,462,464,465,477,478,504,512,516,528,530,531,532,533,534,536,537,538,541,548,552,567,571,575,603,608,610,614,620,636,637,640,641,649,668,705,706,707,709,710,712,717,729,734,753,846,848,850,854,868,907,908,913,926,1015,1031,1054,1055,1056,1057,1058,1061,1072,1207,1219,1265,1266,1269,1278,1404,1406,1408,1416,1578,1579,1580,1582,1589,1685,1693,1806,1812,2103,2104,2105,2110,2524,2528,2803,2807,3152,3153,3156,3605,4202,4204,5043,6301,6302,8401,12600,25199};
dp[27720] = {27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,140,141,142,143,144,145,146,148,149,150,151,152,153,154,155,156,157,158,160,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,185,187,188,191,192,193,194,196,197,199,200,202,203,206,207,208,209,210,213,214,215,219,221,222,223,224,225,228,230,232,233,234,235,236,238,239,240,241,242,243,244,245,246,247,248,250,251,252,254,256,257,261,262,266,267,270,271,275,276,282,283,287,290,293,297,299,306,313,316,318,320,324,326,327,328,331,332,336,337,338,339,340,341,344,345,346,347,349,351,352,358,360,367,371,375,377,391,392,393,394,395,396,398,399,400,401,403,404,406,409,410,412,420,430,432,434,435,442,449,452,453,455,461,464,469,470,471,473,475,476,477,478,482,484,491,501,503,504,507,509,510,517,520,522,549,557,623,627,631,641,642,651,659,668,670,672,674,680,699,700,703,704,712,731,775,776,777,779,780,782,787,801,804,825,851,871,930,932,934,938,952,997,998,1003,1016,1159,1160,1161,1162,1163,1166,1177,1270,1280,1327,1339,1391,1392,1395,1404,1544,1546,1548,1556,1853,1861,1986,1992,2313,2314,2315,2320,2529,2776,2780,3083,3087,3467,3468,3471,3965,4622,4624,5547,6931,6932,9241,13860,27719};
dp[45360] = {22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,236,237,238,239,240,242,243,244,246,247,248,249,250,251,252,254,255,258,260,261,262,263,264,265,266,267,268,269,270,271,273,274,276,277,278,280,281,282,283,284,285,286,287,288,290,292,293,294,296,297,298,299,300,301,302,303,304,305,308,310,312,313,317,320,322,323,324,325,326,327,328,329,330,331,333,334,335,336,337,338,339,340,341,342,345,348,349,351,352,353,354,357,359,360,363,365,370,372,374,376,380,381,382,384,386,387,388,389,390,391,392,393,394,395,397,398,399,401,402,404,408,409,414,415,416,418,420,421,422,424,425,427,428,429,430,431,432,433,434,436,437,438,439,440,441,443,447,448,451,455,456,457,460,462,467,469,473,484,496,512,514,515,516,520,522,524,526,534,535,548,549,550,551,555,556,557,561,562,567,568,571,574,575,576,578,579,581,582,585,587,588,592,606,622,636,637,638,639,640,641,643,644,645,648,649,654,658,662,664,665,682,700,716,729,733,741,763,764,765,767,769,770,771,772,776,781,785,814,818,819,822,824,825,837,846,848,850,852,858,864,866,892,950,951,952,953,954,956,957,958,961,968,991,1015,1019,1023,1051,1088,1090,1094,1100,1120,1140,1141,1144,1145,1153,1172,1265,1266,1267,1269,1270,1272,1277,1294,1305,1329,1518,1520,1522,1526,1540,1627,1628,1633,1646,1685,1689,1705,1894,1895,1896,1897,1898,1901,1912,2167,2179,2273,2274,2277,2286,2524,2526,2528,2536,2838,2839,2840,2842,2849,3029,3037,3246,3252,3783,3784,3785,3790,4540,4544,5043,5047,5672,5673,5676,6485,7562,7564,9075,11341,11342,15121,22680,45359};
dp[50400] = {23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,250,251,252,253,254,255,256,258,260,261,262,263,264,265,266,267,268,270,271,274,275,276,278,279,281,282,284,289,290,291,293,294,295,296,297,298,299,301,302,303,304,305,306,310,311,312,313,314,316,317,318,319,322,323,324,325,326,327,328,329,331,334,336,337,338,340,342,343,344,346,348,349,350,351,354,355,356,357,358,359,360,361,362,363,364,365,366,368,369,370,371,372,373,375,377,381,383,384,386,387,390,394,395,396,398,410,412,414,416,420,421,422,424,428,429,430,431,432,433,434,435,436,437,439,440,441,442,443,446,447,448,450,451,458,459,460,461,462,463,465,466,469,470,473,478,479,484,491,492,498,499,503,505,513,514,515,517,521,524,526,529,530,531,532,533,534,535,536,537,538,539,542,544,549,550,553,557,560,568,570,572,576,578,580,583,590,602,604,609,610,611,615,616,617,619,621,622,628,637,638,639,641,642,645,648,650,651,669,681,682,689,697,706,707,708,709,710,711,713,714,715,718,719,724,730,734,735,736,745,754,770,788,809,813,821,847,848,849,851,853,854,855,856,860,861,869,898,908,909,912,914,915,927,954,1016,1020,1032,1055,1056,1057,1058,1059,1061,1062,1063,1066,1073,1096,1127,1131,1135,1163,1208,1210,1214,1220,1240,1266,1267,1270,1271,1279,1298,1405,1406,1407,1409,1410,1412,1417,1434,1449,1473,1579,1580,1581,1583,1584,1590,1605,1686,1688,1690,1694,1708,1807,1808,1813,1826,2023,2039,2104,2105,2106,2107,2108,2111,2122,2407,2419,2525,2526,2529,2538,2804,2806,2808,2816,3153,3154,3155,3157,3164,3365,3373,3606,3612,4203,4204,4205,4210,5044,5048,5603,5607,6302,6303,6306,7205,8402,8404,10083,12601,12602,16801,25200,50399};
dp[55440] = {28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,220,222,223,224,225,226,227,228,229,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,262,263,265,266,267,268,269,271,272,274,276,277,278,280,281,282,283,284,288,290,291,292,294,296,298,300,302,304,306,307,308,311,314,316,317,318,319,321,322,323,324,325,326,327,328,329,330,332,333,334,337,338,339,340,341,342,343,344,345,346,347,348,350,351,352,353,354,356,358,359,360,361,368,371,372,373,376,378,382,386,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,410,411,412,413,417,420,421,422,426,431,432,433,434,435,436,440,443,445,450,452,453,454,456,460,462,464,465,469,470,471,472,473,474,475,476,477,478,479,481,482,483,485,486,488,489,492,493,496,499,502,504,505,506,508,510,511,512,514,515,518,521,522,523,524,527,528,534,539,547,550,551,558,563,564,573,577,580,593,605,612,624,626,628,631,632,634,636,642,643,646,652,653,657,660,669,670,671,673,675,676,677,681,682,688,700,701,702,704,705,708,711,713,714,716,732,735,742,771,776,777,778,779,780,781,783,784,785,788,789,794,795,802,805,806,808,826,840,852,854,860,862,872,889,893,901,904,931,932,933,935,937,938,939,940,941,944,953,982,998,999,1002,1004,1005,1017,1021,1044,1061,1160,1161,1162,1163,1164,1166,1167,1168,1171,1178,1201,1239,1243,1247,1271,1272,1275,1281,1302,1328,1330,1334,1340,1360,1392,1393,1396,1397,1405,1424,1545,1546,1547,1549,1550,1552,1557,1574,1593,1617,1691,1711,1854,1856,1858,1862,1876,1987,1988,1993,2006,2314,2315,2316,2317,2318,2321,2332,2530,2540,2647,2659,2777,2778,2781,2790,3084,3086,3088,3096,3468,3469,3470,3472,3479,3701,3709,3966,3972,4623,4624,4625,4630,5049,5548,5552,6163,6167,6932,6933,6936,7925,9242,9244,11091,13861,13862,18481,27720,55439};
dp[83160] = {29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,256,257,258,259,260,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,281,284,285,286,287,288,289,290,291,292,293,294,295,297,299,300,301,303,304,305,306,308,309,310,313,314,315,316,318,319,320,321,322,324,326,328,329,330,331,332,333,334,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,353,354,355,356,359,360,362,364,367,368,369,370,373,375,377,379,381,382,389,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,410,411,412,413,414,415,416,417,420,422,423,424,430,432,433,434,436,437,438,439,440,442,444,446,448,451,454,455,456,457,463,466,467,471,472,473,475,476,477,478,479,480,481,483,484,486,487,488,492,493,495,500,503,505,506,507,508,509,511,512,513,517,518,519,521,522,523,524,526,527,537,538,539,551,556,559,562,566,575,576,577,578,580,589,596,599,604,605,606,609,611,615,616,618,624,625,627,629,630,633,637,640,643,644,645,650,653,655,661,663,664,667,670,672,674,676,680,682,684,692,695,701,702,703,704,705,706,707,708,709,710,712,713,714,716,719,722,723,724,732,733,749,752,760,770,774,777,778,779,780,781,782,783,784,788,789,791,797,798,803,806,810,811,815,823,827,853,857,864,873,876,895,932,934,936,937,940,942,944,954,957,958,961,967,968,988,999,1000,1001,1005,1006,1007,1011,1012,1018,1031,1072,1095,1155,1161,1162,1163,1164,1165,1166,1168,1169,1170,1173,1174,1179,1190,1198,1202,1204,1222,1225,1256,1272,1274,1282,1292,1324,1329,1333,1341,1381,1393,1394,1395,1397,1399,1400,1401,1402,1406,1415,1444,1493,1494,1497,1499,1500,1512,1525,1539,1546,1548,1550,1552,1558,1565,1566,1592,1855,1859,1863,1891,1901,1902,1911,1932,1988,1990,1994,2000,2020,2085,2086,2089,2090,2098,2117,2315,2316,2317,2319,2320,2322,2327,2344,2385,2409,2531,2551,2778,2780,2782,2786,2800,2977,2978,2983,2996,3085,3089,3105,3469,3470,3471,3472,3473,3476,3487,3790,3800,3967,3979,4163,4164,4167,4176,4624,4626,4628,4636,5549,5557,5946,5952,6933,6934,6935,6940,7569,8320,8324,9243,9247,10397,10398,10401,11885,13862,13864,16635,20791,20792,27721,41580,83159};
dp[110880] = {29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,295,296,297,299,300,301,302,303,304,305,307,308,309,310,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,367,369,370,371,372,373,374,376,377,378,379,380,382,383,385,386,387,388,389,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,411,412,413,414,415,416,417,418,419,421,422,423,426,427,428,431,432,433,434,435,436,437,438,440,441,442,444,445,446,451,452,453,454,455,456,457,458,459,461,463,464,465,466,467,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,489,490,491,493,494,497,500,503,504,505,506,507,508,509,510,511,512,513,515,516,517,519,520,522,523,524,525,528,529,531,532,533,535,540,542,544,546,548,550,551,552,554,556,557,559,560,562,564,565,566,572,574,576,578,581,584,586,588,594,596,598,606,613,625,626,627,629,630,631,632,633,634,635,637,638,640,641,642,643,644,645,647,649,653,654,657,658,661,662,664,665,666,670,671,672,673,674,675,676,677,678,682,683,686,687,688,689,690,691,695,700,701,702,703,705,706,707,709,712,714,715,716,717,718,722,727,733,734,736,742,743,746,756,772,777,778,779,780,781,782,783,784,785,786,788,789,790,791,792,793,794,795,796,797,803,804,806,807,809,813,816,818,822,826,827,828,835,841,851,853,854,855,860,861,863,865,872,873,874,884,890,892,894,896,900,902,904,905,912,922,930,932,933,934,935,936,937,938,939,940,941,942,943,944,945,947,950,954,955,964,970,983,999,1000,1001,1003,1004,1005,1006,1009,1010,1018,1019,1022,1026,1032,1042,1045,1062,1067,1075,1079,1091,1100,1116,1133,1137,1153,1159,1161,1162,1163,1164,1165,1166,1167,1168,1169,1172,1174,1179,1180,1187,1202,1217,1240,1242,1244,1248,1249,1250,1252,1262,1272,1273,1276,1282,1283,1303,1320,1329,1330,1331,1335,1336,1337,1341,1342,1346,1348,1361,1393,1394,1395,1397,1398,1401,1402,1404,1406,1407,1425,1455,1464,1515,1546,1547,1548,1549,1550,1551,1553,1554,1555,1558,1559,1564,1575,1594,1598,1600,1610,1618,1652,1692,1694,1702,1712,1744,1769,1773,1781,1821,1855,1856,1857,1859,1861,1862,1863,1864,1868,1877,1906,1988,1989,1992,1994,1995,2007,2029,2034,2069,2315,2316,2317,2318,2319,2321,2322,2323,2326,2333,2356,2471,2475,2479,2507,2531,2532,2541,2562,2648,2650,2654,2660,2680,2778,2779,2782,2783,2791,2810,3085,3086,3087,3089,3090,3092,3097,3114,3177,3201,3371,3391,3469,3470,3471,3473,3474,3480,3495,3702,3704,3706,3710,3724,3967,3968,3973,3986,4624,4625,4626,4627,4628,4631,4642,5050,5060,5287,5299,5549,5550,5553,5562,6164,6166,6168,6176,6933,6934,6935,6937,6944,7397,7405,7926,7932,9243,9244,9245,9250,10089,11092,11096,12323,12327,13862,13863,13866,15845,18482,18484,22179,27721,27722,36961,55440,110879};
dp[166320] = {30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,298,299,300,301,302,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,360,361,362,363,365,367,368,369,370,371,372,373,374,375,376,377,378,380,381,382,383,384,386,388,389,390,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,421,422,423,424,425,426,428,429,430,431,433,434,435,436,437,438,439,440,441,442,443,444,445,447,448,449,451,452,454,455,456,457,458,460,462,464,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,487,488,489,490,491,493,494,495,496,497,498,501,502,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,522,523,524,525,526,527,528,529,530,532,536,538,539,540,541,542,544,545,547,549,552,553,554,557,558,560,561,562,563,565,566,567,569,572,573,575,576,577,578,579,580,581,582,588,590,593,595,597,599,600,605,606,607,610,611,612,613,614,616,617,618,619,625,626,628,629,630,631,632,633,634,636,638,641,644,645,646,647,648,650,651,652,654,655,656,659,661,662,664,665,668,671,672,673,675,676,677,678,679,681,683,684,685,689,690,693,694,696,697,700,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,720,721,722,723,724,725,728,733,734,736,737,743,744,749,750,753,754,757,761,771,772,773,775,778,779,780,781,782,783,784,785,786,787,789,790,791,792,796,797,798,799,800,802,804,806,807,808,809,810,811,812,814,815,816,818,820,824,825,826,828,829,830,832,836,841,842,846,854,855,856,858,862,864,865,866,868,872,874,876,877,884,891,892,895,896,903,906,907,910,911,931,933,934,935,937,938,939,940,941,942,943,945,946,948,949,950,955,957,958,959,960,962,968,969,970,972,974,984,989,990,1000,1001,1002,1003,1004,1006,1007,1008,1012,1013,1016,1018,1019,1021,1023,1031,1032,1033,1036,1043,1046,1063,1067,1073,1096,1102,1106,1119,1156,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1173,1174,1175,1176,1177,1178,1180,1182,1191,1192,1199,1200,1203,1205,1209,1212,1218,1223,1224,1226,1232,1241,1245,1249,1253,1257,1261,1273,1274,1275,1277,1280,1283,1285,1293,1294,1297,1304,1325,1326,1330,1332,1334,1336,1340,1342,1344,1362,1365,1382,1390,1394,1395,1396,1397,1398,1399,1400,1401,1402,1403,1405,1406,1407,1409,1412,1416,1417,1426,1444,1445,1494,1495,1496,1498,1500,1501,1504,1505,1513,1514,1526,1530,1536,1540,1547,1548,1549,1551,1552,1553,1554,1558,1559,1561,1566,1567,1568,1576,1593,1595,1603,1607,1619,1620,1646,1687,1693,1697,1713,1777,1856,1858,1860,1864,1866,1868,1878,1892,1902,1903,1906,1912,1913,1933,1936,1976,1989,1990,1991,1995,1996,1997,2001,2002,2008,2021,2062,2086,2087,2088,2090,2091,2094,2097,2099,2100,2118,2157,2175,2235,2316,2317,2318,2319,2320,2321,2323,2324,2325,2328,2329,2334,2345,2380,2386,2390,2392,2410,2444,2532,2534,2542,2552,2584,2649,2653,2661,2701,2779,2780,2781,2783,2785,2786,2787,2788,2792,2801,2830,2978,2979,2982,2984,2985,2997,3024,3037,3077,3086,3088,3090,3092,3098,3106,3132,3470,3471,3472,3473,3474,3476,3477,3478,3481,3488,3511,3703,3707,3711,3739,3791,3792,3801,3822,3968,3970,3974,3980,4000,4164,4165,4168,4169,4177,4196,4625,4626,4627,4629,4630,4632,4637,4654,4761,4785,5051,5071,5550,5552,5554,5558,5572,5947,5948,5953,5966,6165,6169,6185,6934,6935,6936,6937,6938,6941,6952,7570,7580,7927,7939,8321,8322,8325,8334,9244,9246,9248,9256,10398,10399,10400,10402,10409,11093,11101,11886,11892,13863,13864,13865,13870,15129,16636,16640,18483,18487,20792,20793,20796,23765,27722,27724,33267,41581,41582,55441,83160,166319};
for(st dz : d){
for(int i : s){
int w = 1;
for(int c = 1; c <= dz.i; ++c) w *= dz.d, tmp.emplace(i*w);
tmp.emplace(i);
}
s = tmp; tmp.clear();
} vector<int> D; for(int i : s) if(i!=1) D.emplace_back(i);
unordered_map<ll, bool> czy, czyantyp; for(int i : D){czy[i] = 1;} for(int i : antyp) czyantyp[i] = 1;
for(int i : D) if(!czyantyp[i]) dp[i].emplace(i-1);
for(int i = 0; i < (int) D.size(); ++i){
int a = D[i];
for(int j = 0; j < (int) D.size(); ++j){
int b = D[j];
if(czyantyp[(ll) a * b] || !czy[(ll) a * b]) continue;
for(int w : dp[a]) dp[a*b].emplace(w+b-1);
}
}
//printf("%d\n", (int) dp[n].size());
vector<int> v;
printf("dp[%d] = {", n);
for(int i : dp[n]) v.emplace_back(i);
for(int i = 0; i < (int) v.size()-1; ++i) printf("%d,", v[i]);
printf("%d};\n", v.back());
return 0;
}
Compilation message
toy.cpp: In function 'int main()':
toy.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
23 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
596 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |