数字排列问题!1234567890组成四位数字0可以在首位排列出所有组合能列出来给我呢?大概一万多
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了数字排列问题!1234567890组成四位数字0可以在首位排列出所有组合能列出来给我呢?大概一万多相关的知识,希望对你有一定的参考价值。
参考技术A 没有那么多,10*9*8*7=5040个。字数超出最大允许值,请删减!后面省略若干0123,0124,0125,0126,0127,0128,0129,0132,0134,0135,0136,0137,0138,0139,0142,0143,0145,0146,0147,0148,0149,0152,0153,0154,0156,0157,0158,0159,0162,0163,0164,0165,0167,0168,0169,0172,0173,0174,0175,0176,0178,0179,0182,0183,0184,0185,0186,0187,0189,0192,0193,0194,0195,0196,0197,0198,0213,0214,0215,0216,0217,0218,0219,0231,0234,0235,0236,0237,0238,0239,0241,0243,0245,0246,0247,0248,0249,0251,0253,0254,0256,0257,0258,0259,0261,0263,0264,0265,0267,0268,0269,0271,0273,0274,0275,0276,0278,0279,0281,0283,0284,0285,0286,0287,0289,0291,0293,0294,0295,0296,0297,0298,0312,0314,0315,0316,0317,0318,0319,0321,0324,0325,0326,0327,0328,0329,0341,0342,0345,0346,0347,0348,0349,0351,0352,0354,0356,0357,0358,0359,0361,0362,0364,0365,0367,0368,0369,0371,0372,0374,0375,0376,0378,0379,0381,0382,0384,0385,0386,0387,0389,0391,0392,0394,0395,0396,0397,0398,0412,0413,0415,0416,0417,0418,0419,0421,0423,0425,0426,0427,0428,0429,0431,0432,0435,0436,0437,0438,0439,0451,0452,0453,0456,0457,0458,0459,0461,0462,0463,0465,0467,0468,0469,0471,0472,0473,0475,0476,0478,0479,0481,0482,0483,0485,0486,0487,0489,0491,0492,0493,0495,0496,0497,0498,0512,0513,0514,0516,0517,0518,0519,0521,0523,0524,0526,0527,0528,0529,0531,0532,0534,0536,0537,0538,0539,0541,0542,0543,0546,0547,0548,0549,0561,0562,0563,0564,0567,0568,0569,0571,0572,0573,0574,0576,0578,0579,0581,0582,0583,0584,0586,0587,0589,0591,0592,0593,0594,0596,0597,0598,0612,0613,0614,0615,0617,0618,0619,0621,0623,0624,0625,0627,0628,0629,0631,0632,0634,0635,0637,0638,0639,0641,0642,0643,0645,0647,0648,0649,0651,0652,0653,0654,0657,0658,0659,0671,0672,0673,0674,0675,0678,0679,0681,0682,0683,0684,0685,0687,0689,0691,0692,0693,0694,0695,0697,0698,0712,0713,0714,0715,0716,0718,0719,0721,0723,0724,0725,0726,0728,0729,0731,0732,0734,0735,0736,0738,0739,0741,0742,0743,0745,0746,0748,0749,0751,0752,0753,0754,0756,0758,0759,0761,0762,0763,0764,0765,0768,0769,0781,0782,0783,0784,0785,0786,0789,0791,0792,0793,0794,0795,0796,0798,0812,0813,0814,0815,0816,0817,0819,0821,0823,0824,0825,0826,0827,0829,0831,0832,0834,0835,0836,0837,0839,0841,0842,0843,0845,0846,0847,0849,0851,0852,0853,0854,0856,0857,0859,0861,0862,0863,0864,0865,0867,0869,0871,0872,0873,0874,0875,0876,0879,0891,0892,0893,0894,0895,0896,0897,0912,0913,0914,0915,0916,0917,0918,0921,0923,0924,0925,0926,0927,0928,0931,0932,0934,0935,0936,0937,0938,0941,0942,0943,0945,0946,0947,0948,0951,0952,0953,0954,0956,0957,0958,0961,0962,0963,0964,0965,0967,0968,0971,0972,0973,0974,0975,0976,0978,0981,0982,0983,0984,0985,0986,0987,1023,1024,1025,1026,1027,1028,1029,1032,1034,1035,1036,1037,1038,1039,1042,1043,1045,1046,1047,1048,1049,1052,1053,1054,1056,1057,1058,1059,1062,1063,1064,1065,1067,1068,1069,1072,1073,1074,1075,1076,1078,1079,1082,1083,1084,1085,1086,1087,1089,1092,1093,1094,1095,1096,1097,1098,1203,1204,1205,1206,1207,1208,1209,1230,1234,1235,1236,1237,1238,1239,1240,1243,1245,1246,1247,1248,1249,1250,1253,1254,1256,1257,1258,1259,1260,1263,1264,1265,1267,1268,1269,1270,1273,1274,1275,1276,1278,1279,1280,1283,1284,1285,1286,1287,1289,1290,1293,1294,1295,1296,1297,1298,1302,1304,1305,1306,1307,1308,1309,1320,1324,1325,1326,1327,1328,1329,1340,1342,1345,1346,1347,1348,1349,1350,1352,1354,1356,1357,1358,1359,1360,1362,1364,1365,1367,1368,1369,1370,1372,1374,1375,1376,1378,1379,1380,1382,1384,1385,1386,1387,1389,1390,1392,1394,1395,1396,1397,1398,1402,1403,1405,1406,1407,1408,1409,1420,1423,1425,1426,1427,1428,1429,1430,1432,1435,1436,1437,1438,1439,1450,1452,1453,1456,1457,1458,1459,1460,1462,1463,1465,1467,1468,1469,1470,1472,1473,1475,1476,1478,1479,1480,1482,1483,1485,1486,1487,1489,1490,1492,1493,1495,1496,1497,1498,1502,1503,1504,1506,1507,1508,1509,1520,1523,1524,1526,1527,1528,1529,1530,1532,1534,1536,1537,1538,1539,1540,1542,1543,1546,1547,1548,1549,1560,1562,1563,1564,1567,1568,1569,1570,1572,1573,1574,1576,1578,1579,1580,1582,1583,1584,1586,1587,1589,1590,1592,1593,1594,1596,1597,1598,1602,1603,1604,1605,1607,1608,1609,1620,1623,1624,1625,1627,1628,1629,1630,1632,1634,1635,1637,1638,1639,1640,1642,1643,1645,1647,1648,1649,1650,1652,1653,1654,1657,1658,1659,1670,1672,1673,1674,1675,1678,1679,1680,1682,1683,1684,1685,1687,1689,1690,1692,1693,1694,1695,1697,1698,1702,1703,1704,1705,1706,1708,1709,1720,1723,1724,1725,1726,1728,1729,1730,1732,1734,1735,1736,1738,1739,1740,1742,1743,1745,1746,1748,1749,1750,1752,1753,1754,1756,1758,1759,1760,1762,1763,1764,1765,1768,1769,1780,1782,1783,1784,1785,1786,1789,1790,1792,1793,1794,1795,1796,1798,1802,1803,1804,1805,1806,1807,1809,1820,1823,1824,1825,1826,1827,1829,1830,1832,1834,1835,1836,1837,1839,1840,1842,1843,1845,1846,1847,1849,1850,1852,1853,1854,1856,1857,1859,1860,1862,1863,1864,1865,1867,1869,1870,1872,1873,1874,1875,1876,1879,1890,1892,1893,1894,1895,1896,1897,1902,1903,1904,1905,1906,1907,1908,1920,1923,1924,1925,1926,1927,1928,1930,1932,1934,1935,1936,1937,1938,1940,1942,1943,1945,1946,1947,1948,1950,1952,1953,1954,1956,1957,1958,1960,1962,1963,1964,1965,1967,1968,1970,1972,1973,1974,1975,1976,1978,1980,1982,1983,1984,1985,1986,1987,2013,2014,2015,2016,2017,2018,2019,2031,2034,2035,2036,2037,2038,2039,2041,2043,2045,2046,2047,2048,2049,2051,2053,2054,2056,2057,2058,2059,2061,2063,2064,2065,2067,2068,2069,2071,2073,2074,2075,2076,2078,2079,2081,2083,2084,2085,2086,2087,2089,2091,2093,2094,2095,2096,2097,2098,2103,2104,2105,2106,2107,2108,2109,2130,2134,2135,2136,2137,2138,2139,2140,2143,2145,2146,2147,2148,2149,2150,2153,2154,2156,2157,2158,2159,2160,2163,2164,2165,2167,2168,2169,2170,2173,2174,2175,2176,2178,2179,2180,2183,2184,2185,2186,2187,2189,2190,2193,2194,2195,2196,2197,2198,2301,2304,2305,2306,2307,2308,2309,2310,2314,2315,2316,2317,2318,2319,2340,2341,2345,2346,2347,2348,2349,2350,2351,2354,2356,2357,2358,2359,2360,2361,2364,2365,2367,2368,2369,2370,2371,2374,2375,2376,2378,2379,2380,2381,2384,2385,2386,2387,2389,2390,2391,2394,2395,2396,2397,2398,2401,2403,2405,2406,2407,2408,2409,2410,2413,2415,2416,2417,2418,2419,2430,2431,2435,2436,2437,2438,2439,2450,2451,2453,2456,2457,2458,2459,2460,2461,2463,2465,2467,2468,2469,2470,2471,2473,2475,2476,2478,2479,2480,2481,2483,2485,2486,2487,2489,2490,2491,2493,2495,2496,2497,2498,2501,2503,2504,2506,2507,2508,2509,2510,2513,2514,2516,2517,2518,2519,2530,2531,2534,2536,2537,2538,2539,2540,2541,2543,2546,2547,2548,2549,2560,2561,2563,2564,2567,2568,2569,2570,2571,2573,2574,2576,2578,2579,2580,2581,2583,2584,2586,2587,2589,2590,2591,2593,2594,2596,2597,2598,2601,2603,2604,2605,2607,2608,2609,2610,2613,2614,2615,2617,2618,2619,2630,2631,2634,2635,2637,2638,2639,2640,2641,2643,2645,2647,2648,2649,2650,2651,2653,2654,2657,2658,2659,2670,2671,2673,2674,2675,2678,2679,2680,2681,2683,2684,2685,2687,2689,2690,2691,2693,2694,2695,2697,2698,2701,2703,2704,2705,2706,2708,2709,2710,2713,2714,2715,2716,2718,2719,2730,2731,2734,2735,2736,2738,2739,2740,2741,2743,2745,2746,2748,2749,2750,2751,2753,2754,2756,2758,2759,2760,2761,2763,2764,2765,2768,2769,2780,2781,2783,2784,2785,2786,2789,2790,2791,2793,2794,2795,2796,2798,2801,2803,2804,2805,2806,2807,2809,2810,2813,2814,2815,2816,2817,2819,2830,2831,2834,2835,2836,2837,2839,2840,2841,2843,2845,2846,2847,2849,2850,2851,2853,2854,2856,2857,2859,2860,2861,2863,2864,2865,2867,2869,2870,2871,2873,2874,2875,2876,2879,2890,2891,2893,2894,2895,2896,2897,2901,2903,2904,2905,2906,2907,2908,2910,2913,2914,2915,2916,2917,2918,2930,2931,2934,2935,2936,2937,2938,2940,2941,2943,2945,2946,2947,2948,2950,2951,2953,2954,2956,2957,2958,2960,2961,2963,2964,2965,2967,2968,2970,2971,2973,2974,2975,2976,2978,2980,2981,2983,2984,2985,2986,2987,3012,3014,3015,3016,3017,3018,3019,3021,3024,3025,3026,3027,3028,3029,3041,3042,3045,3046,3047,3048,3049,3051,3052,3054,3056,3057,3058,3059,3061,3062,3064,3065,3067,3068,3069,3071,3072,3074,3075,3076,3078,3079,3081,3082,3084,3085,3086,3087,3089,3091,3092,3094,3095,3096,3097,3098,3102,3104,3105,3106,3107,3108,3109,3120,3124,3125,3126,3127,3128,3129,3140,3142,3145,3146,3147,3148,3149,3150,3152,3154,3156,3157,3158,3159,3160,3162,3164,3165,3167,3168,3169,3170,3172,3174,3175,3176,3178,3179,3180,3182,3184,3185,3186,3187,3189,3190,3192,3194,3195,3196,3197,3198,3201,... 参考技术B 就是0000-9999
一万个 参考技术C 1234234534564567567867897890890190120123
随机生成唯一的四位字符串-由大小写字母和数字组成
---法1:数据库方法
create or replace function FUNC_GEN_PAY_ID
return CHAR
is
v_param varchar(1);--字符参数
v_payid_param varchar(4);--字符累加
v_pay_id varchar(4);--4位字符
v_x number;--循环的次数变量
v_y number;--是否生成 1:是 0:否
v_rowCnt number ;
begin
--初始值
v_x :=1;
v_y :=1;
v_payid_param :=‘‘;
WHILE v_y =1 LOOP
FOR v_x IN REVERSE 1 .. 4 LOOP
select * into v_param from(
select *
from(
select chr(ascii(‘A‘)+ROWNUM-1) S from dual connect by rownum<=26
UNION ALL
select chr(ascii(‘a‘)+ROWNUM-1) S from dual connect by rownum<=26
UNION ALL
select chr(ascii(‘0‘)+ROWNUM-1) S from dual connect by rownum<=10
)ORDER BY dbms_random.value)
where rownum<2;
v_payid_param :=v_payid_param||v_param;
END LOOP;
SELECT COUNT(*)
INTO v_rowCnt
FROM DUAL
WHERE EXISTS(
SELECT 1
FROM yst_pay_info
WHERE is_delete = ‘0‘
AND pay_id=v_payid_param);
IF v_rowCnt = 1 THEN
v_y :=1;
ELSE
v_pay_id :=v_payid_param;
v_y :=0;
END IF;
END LOOP;
return(v_pay_id);
end FUNC_GEN_PAY_ID;
--法2:Java方法(未校验是否唯一)
public class aa {
/**
* @param args
*/
public static void main(String[] args) {
System.out.println(get4Code());
}
public static String get4Code(){
StringBuffer sb = new StringBuffer();
String codes ="qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890";
Random random = new Random();
for(int i=0;i<codes.length();i++){
char c = codes.charAt(random.nextInt(codes.length()));
System.out.println(c);
if(sb.length()==4) break;
if(!sb.toString().contains(c+"")) sb.append(c);
}
return sb.toString();
}
}
以上是关于数字排列问题!1234567890组成四位数字0可以在首位排列出所有组合能列出来给我呢?大概一万多的主要内容,如果未能解决你的问题,请参考以下文章