From 62ca6f2e83e27b8b77eca3e26c4284d7b49e0581 Mon Sep 17 00:00:00 2001 From: e0dZTBk Date: Tue, 21 Feb 2023 20:47:46 +0800 Subject: [PATCH] add peerin's code --- OpenJudge/ProblemSet/1510/input | 4 + OpenJudge/ProblemSet/1510/output | 4 + OpenJudge/ProblemSet/1510/problem.md | 37 ++++++ OpenJudge/ProblemSet/2683/input | 1 + OpenJudge/ProblemSet/2683/output | 1 + OpenJudge/ProblemSet/2683/problem.md | 26 ++++ OpenJudge/ProblemSet/2684/input | 1 + OpenJudge/ProblemSet/2684/output | 1 + OpenJudge/ProblemSet/2684/problem.md | 26 ++++ OpenJudge/ProblemSet/2685/input | 1 + OpenJudge/ProblemSet/2685/output | 5 + OpenJudge/ProblemSet/2685/problem.md | 31 +++++ OpenJudge/ProblemSet/2686/input | 1 + OpenJudge/ProblemSet/2686/output | 1 + OpenJudge/ProblemSet/2686/problem.md | 56 +++++++++ OpenJudge/ProblemSet/2687/input | 2 + OpenJudge/ProblemSet/2687/output | 1 + OpenJudge/ProblemSet/2687/problem.md | 59 +++++++++ OpenJudge/ProblemSet/2688/input | 2 + OpenJudge/ProblemSet/2688/output | 2 + OpenJudge/ProblemSet/2688/problem.md | 68 ++++++++++ OpenJudge/ProblemSet/2689/input | 1 + OpenJudge/ProblemSet/2689/output | 1 + OpenJudge/ProblemSet/2689/problem.md | 30 +++++ OpenJudge/ProblemSet/2690/input | 6 + OpenJudge/ProblemSet/2690/output | 6 + OpenJudge/ProblemSet/2690/problem.md | 38 ++++++ OpenJudge/ProblemSet/2691/input | 3 + OpenJudge/ProblemSet/2691/output | 3 + OpenJudge/ProblemSet/2691/problem.md | 33 +++++ OpenJudge/ProblemSet/2692/input | 1 + OpenJudge/ProblemSet/2692/output | 5 + OpenJudge/ProblemSet/2692/problem.md | 36 ++++++ OpenJudge/ProblemSet/2693/input | 4 + OpenJudge/ProblemSet/2693/output | 4 + OpenJudge/ProblemSet/2693/problem.md | 34 +++++ OpenJudge/ProblemSet/2694/input | 22 ++++ OpenJudge/ProblemSet/2694/output | 6 + OpenJudge/ProblemSet/2694/problem.md | 55 +++++++++ OpenJudge/QuestionAns/peerin/1001.c | 15 +++ OpenJudge/QuestionAns/peerin/1002.c | 18 +++ OpenJudge/QuestionAns/peerin/1003.c | 18 +++ OpenJudge/QuestionAns/peerin/1004.c | 18 +++ OpenJudge/QuestionAns/peerin/1005.c | 19 +++ OpenJudge/QuestionAns/peerin/1006.c | 20 +++ OpenJudge/QuestionAns/peerin/1007.c | 19 +++ OpenJudge/QuestionAns/peerin/1008.c | 23 ++++ OpenJudge/QuestionAns/peerin/1009.c | 21 ++++ OpenJudge/QuestionAns/peerin/1010.c | 18 +++ OpenJudge/QuestionAns/peerin/1012.c | 34 +++++ OpenJudge/QuestionAns/peerin/1013.c | 36 ++++++ OpenJudge/QuestionAns/peerin/1014.c | 36 ++++++ OpenJudge/QuestionAns/peerin/1015.c | 38 ++++++ OpenJudge/QuestionAns/peerin/1016.c | 20 +++ OpenJudge/QuestionAns/peerin/1017.c | 42 +++++++ OpenJudge/QuestionAns/peerin/1018.c | 31 +++++ OpenJudge/QuestionAns/peerin/1019.c | 49 ++++++++ OpenJudge/QuestionAns/peerin/1020.c | 24 ++++ OpenJudge/QuestionAns/peerin/1021.c | 25 ++++ OpenJudge/QuestionAns/peerin/1022.c | 25 ++++ OpenJudge/QuestionAns/peerin/1023.c | 24 ++++ OpenJudge/QuestionAns/peerin/1024.c | 33 +++++ OpenJudge/QuestionAns/peerin/1025.c | 68 ++++++++++ OpenJudge/QuestionAns/peerin/1027.c | 37 ++++++ OpenJudge/QuestionAns/peerin/1028.c | 56 +++++++++ OpenJudge/QuestionAns/peerin/1041.c | 84 +++++++++++++ OpenJudge/QuestionAns/peerin/1042.c | 25 ++++ OpenJudge/QuestionAns/peerin/1043.c | 27 ++++ OpenJudge/QuestionAns/peerin/1044.c | 25 ++++ OpenJudge/QuestionAns/peerin/1045.c | 27 ++++ OpenJudge/QuestionAns/peerin/1046.c | 40 ++++++ OpenJudge/QuestionAns/peerin/1047.c | 27 ++++ OpenJudge/QuestionAns/peerin/1048.c | 58 +++++++++ OpenJudge/QuestionAns/peerin/1049.c | 71 +++++++++++ OpenJudge/QuestionAns/peerin/1050.c | 55 +++++++++ OpenJudge/QuestionAns/peerin/1051.c | 48 ++++++++ OpenJudge/QuestionAns/peerin/1052.c | 97 +++++++++++++++ OpenJudge/QuestionAns/peerin/1053.c | 66 ++++++++++ OpenJudge/QuestionAns/peerin/1054.c | 49 ++++++++ OpenJudge/QuestionAns/peerin/1055.c | 92 ++++++++++++++ OpenJudge/QuestionAns/peerin/1060.c | 104 ++++++++++++++++ OpenJudge/QuestionAns/peerin/1061.c | 62 ++++++++++ OpenJudge/QuestionAns/peerin/1062.c | 72 +++++++++++ OpenJudge/QuestionAns/peerin/1068.c | 81 ++++++++++++ OpenJudge/QuestionAns/peerin/1078.c | 71 +++++++++++ OpenJudge/QuestionAns/peerin/1079.c | 23 ++++ OpenJudge/QuestionAns/peerin/1088.c | 25 ++++ OpenJudge/QuestionAns/peerin/1092.c | 26 ++++ OpenJudge/QuestionAns/peerin/1093.c | 39 ++++++ OpenJudge/QuestionAns/peerin/1094.c | 61 +++++++++ OpenJudge/QuestionAns/peerin/1095.c | 34 +++++ OpenJudge/QuestionAns/peerin/1097.c | 31 +++++ OpenJudge/QuestionAns/peerin/1098.c | 25 ++++ OpenJudge/QuestionAns/peerin/1099.c | 45 +++++++ OpenJudge/QuestionAns/peerin/1100.c | 43 +++++++ OpenJudge/QuestionAns/peerin/1101.c | 31 +++++ OpenJudge/QuestionAns/peerin/1107.c | 53 ++++++++ OpenJudge/QuestionAns/peerin/1133.c | 50 ++++++++ OpenJudge/QuestionAns/peerin/1134.c | 63 ++++++++++ OpenJudge/QuestionAns/peerin/1135.c | 83 +++++++++++++ OpenJudge/QuestionAns/peerin/1136.c | 177 +++++++++++++++++++++++++++ OpenJudge/QuestionAns/peerin/1138.c | 28 +++++ OpenJudge/QuestionAns/peerin/1139.c | 35 ++++++ OpenJudge/QuestionAns/peerin/1140.c | 78 ++++++++++++ OpenJudge/QuestionAns/peerin/1141.c | 105 ++++++++++++++++ OpenJudge/QuestionAns/peerin/1144.c | 63 ++++++++++ OpenJudge/QuestionAns/peerin/1145.c | 30 +++++ OpenJudge/QuestionAns/peerin/1146.c | 58 +++++++++ OpenJudge/QuestionAns/peerin/1149.c | 30 +++++ OpenJudge/QuestionAns/peerin/1153.c | 64 ++++++++++ OpenJudge/QuestionAns/peerin/1155.c | 47 +++++++ OpenJudge/QuestionAns/peerin/1158.c | 18 +++ OpenJudge/QuestionAns/peerin/1162.c | 42 +++++++ OpenJudge/QuestionAns/peerin/1163.c | 46 +++++++ OpenJudge/QuestionAns/peerin/1167.c | 43 +++++++ OpenJudge/QuestionAns/peerin/1168.c | 43 +++++++ OpenJudge/QuestionAns/peerin/1169.c | 55 +++++++++ OpenJudge/QuestionAns/peerin/1172.c | 71 +++++++++++ OpenJudge/QuestionAns/peerin/1176.c | 43 +++++++ OpenJudge/QuestionAns/peerin/1178.c | 42 +++++++ OpenJudge/QuestionAns/peerin/1179.c | 76 ++++++++++++ OpenJudge/QuestionAns/peerin/1180.c | 64 ++++++++++ OpenJudge/QuestionAns/peerin/1184.c | 43 +++++++ OpenJudge/QuestionAns/peerin/1187.c | 45 +++++++ OpenJudge/QuestionAns/peerin/1189.c | 29 +++++ OpenJudge/QuestionAns/peerin/1200.c | 31 +++++ OpenJudge/QuestionAns/peerin/1206.c | 31 +++++ OpenJudge/QuestionAns/peerin/1207.c | 35 ++++++ OpenJudge/QuestionAns/peerin/1208.c | 52 ++++++++ OpenJudge/QuestionAns/peerin/1212.c | 55 +++++++++ OpenJudge/QuestionAns/peerin/1213.c | 43 +++++++ OpenJudge/QuestionAns/peerin/1214.c | 47 +++++++ OpenJudge/QuestionAns/peerin/1215.c | 33 +++++ OpenJudge/QuestionAns/peerin/1216.c | 36 ++++++ OpenJudge/QuestionAns/peerin/1217.c | 37 ++++++ OpenJudge/QuestionAns/peerin/1220.c | 58 +++++++++ OpenJudge/QuestionAns/peerin/1221.c | 54 ++++++++ OpenJudge/QuestionAns/peerin/1224.c | 28 +++++ OpenJudge/QuestionAns/peerin/1228.c | 70 +++++++++++ OpenJudge/QuestionAns/peerin/1233.c | 55 +++++++++ OpenJudge/QuestionAns/peerin/1234.c | 32 +++++ OpenJudge/QuestionAns/peerin/1235.c | 32 +++++ OpenJudge/QuestionAns/peerin/1236.c | 32 +++++ OpenJudge/QuestionAns/peerin/1238.c | 18 +++ OpenJudge/QuestionAns/peerin/1240.c | 26 ++++ OpenJudge/QuestionAns/peerin/1241.c | 38 ++++++ OpenJudge/QuestionAns/peerin/1242.c | 44 +++++++ OpenJudge/QuestionAns/peerin/1244.c | 24 ++++ OpenJudge/QuestionAns/peerin/1245.c | 39 ++++++ OpenJudge/QuestionAns/peerin/1247.c | 53 ++++++++ OpenJudge/QuestionAns/peerin/1250.c | 29 +++++ OpenJudge/QuestionAns/peerin/1251.c | 27 ++++ OpenJudge/QuestionAns/peerin/1252.c | 18 +++ OpenJudge/QuestionAns/peerin/1253.c | 28 +++++ OpenJudge/QuestionAns/peerin/1254.c | 63 ++++++++++ OpenJudge/QuestionAns/peerin/1255.c | 54 ++++++++ OpenJudge/QuestionAns/peerin/1268.c | 75 ++++++++++++ OpenJudge/QuestionAns/peerin/1271.c | 127 +++++++++++++++++++ OpenJudge/QuestionAns/peerin/1276.c | 70 +++++++++++ OpenJudge/QuestionAns/peerin/1278.c | 41 +++++++ OpenJudge/QuestionAns/peerin/1286.c | 60 +++++++++ OpenJudge/QuestionAns/peerin/1298.c | 32 +++++ OpenJudge/QuestionAns/peerin/1301.c | 92 ++++++++++++++ OpenJudge/QuestionAns/peerin/1334.c | 39 ++++++ OpenJudge/QuestionAns/peerin/1337.c | 34 +++++ OpenJudge/QuestionAns/peerin/1347.c | 54 ++++++++ OpenJudge/QuestionAns/peerin/1368.c | 55 +++++++++ OpenJudge/QuestionAns/peerin/1370.c | 43 +++++++ OpenJudge/QuestionAns/peerin/1375.c | 25 ++++ OpenJudge/QuestionAns/peerin/1376.c | 51 ++++++++ OpenJudge/QuestionAns/peerin/1382.c | 52 ++++++++ OpenJudge/QuestionAns/peerin/1383.c | 69 +++++++++++ OpenJudge/QuestionAns/peerin/1384.c | 30 +++++ OpenJudge/QuestionAns/peerin/1398.c | 19 +++ OpenJudge/QuestionAns/peerin/1400.c | 18 +++ OpenJudge/QuestionAns/peerin/1403.c | 27 ++++ OpenJudge/QuestionAns/peerin/1404.c | 25 ++++ OpenJudge/QuestionAns/peerin/1416.c | 25 ++++ OpenJudge/QuestionAns/peerin/1417.c | 24 ++++ OpenJudge/QuestionAns/peerin/1434.c | 65 ++++++++++ OpenJudge/QuestionAns/peerin/1455.c | 27 ++++ OpenJudge/QuestionAns/peerin/1457.c | 55 +++++++++ OpenJudge/QuestionAns/peerin/1458.c | 32 +++++ OpenJudge/QuestionAns/peerin/1459.c | 54 ++++++++ OpenJudge/QuestionAns/peerin/1460.c | 45 +++++++ OpenJudge/QuestionAns/peerin/1461.c | 36 ++++++ OpenJudge/QuestionAns/peerin/1462.c | 60 +++++++++ OpenJudge/QuestionAns/peerin/1463.c | 28 +++++ OpenJudge/QuestionAns/peerin/1464.c | 26 ++++ OpenJudge/QuestionAns/peerin/1465.c | 27 ++++ OpenJudge/QuestionAns/peerin/1466.c | 27 ++++ OpenJudge/QuestionAns/peerin/1468.c | 99 +++++++++++++++ OpenJudge/QuestionAns/peerin/1469.c | 30 +++++ OpenJudge/QuestionAns/peerin/1473.c | 46 +++++++ OpenJudge/QuestionAns/peerin/1487.c | 38 ++++++ OpenJudge/QuestionAns/peerin/1490.c | 48 ++++++++ OpenJudge/QuestionAns/peerin/1494.c | 36 ++++++ OpenJudge/QuestionAns/peerin/1495.c | 36 ++++++ OpenJudge/QuestionAns/peerin/1497.c | 66 ++++++++++ OpenJudge/QuestionAns/peerin/1503.c | 65 ++++++++++ OpenJudge/QuestionAns/peerin/1508.c | 58 +++++++++ OpenJudge/QuestionAns/peerin/1509.c | 45 +++++++ OpenJudge/QuestionAns/peerin/1510.c | 57 +++++++++ OpenJudge/QuestionAns/peerin/1511.c | 66 ++++++++++ OpenJudge/QuestionAns/peerin/1512.c | 32 +++++ OpenJudge/QuestionAns/peerin/1561.c | 59 +++++++++ OpenJudge/QuestionAns/peerin/1586.c | 56 +++++++++ OpenJudge/QuestionAns/peerin/1593.c | 62 ++++++++++ OpenJudge/QuestionAns/peerin/1607.c | 29 +++++ OpenJudge/QuestionAns/peerin/1611.c | 37 ++++++ OpenJudge/QuestionAns/peerin/1633.c | 51 ++++++++ OpenJudge/QuestionAns/peerin/1634.c | 93 ++++++++++++++ OpenJudge/QuestionAns/peerin/1637.c | 79 ++++++++++++ OpenJudge/QuestionAns/peerin/1653.c | 38 ++++++ OpenJudge/QuestionAns/peerin/1764.c | 36 ++++++ OpenJudge/QuestionAns/peerin/1766.c | 55 +++++++++ OpenJudge/QuestionAns/peerin/1769.c | 32 +++++ OpenJudge/QuestionAns/peerin/1837.c | 36 ++++++ OpenJudge/QuestionAns/peerin/1840.c | 65 ++++++++++ OpenJudge/QuestionAns/peerin/1897.c | 36 ++++++ OpenJudge/QuestionAns/peerin/1937.c | 46 +++++++ OpenJudge/QuestionAns/peerin/2025.c | 20 +++ OpenJudge/QuestionAns/peerin/2026.c | 69 +++++++++++ OpenJudge/QuestionAns/peerin/2033.c | 33 +++++ OpenJudge/QuestionAns/peerin/2036.c | 32 +++++ OpenJudge/QuestionAns/peerin/2038.c | 42 +++++++ OpenJudge/QuestionAns/peerin/2039.c | 68 ++++++++++ OpenJudge/QuestionAns/peerin/2040.c | 18 +++ OpenJudge/QuestionAns/peerin/2041.c | 64 ++++++++++ OpenJudge/QuestionAns/peerin/2042.c | 49 ++++++++ OpenJudge/QuestionAns/peerin/2043.c | 40 ++++++ OpenJudge/QuestionAns/peerin/2045.c | 65 ++++++++++ OpenJudge/QuestionAns/peerin/2046.c | 32 +++++ OpenJudge/QuestionAns/peerin/2293.c | 58 +++++++++ OpenJudge/QuestionAns/peerin/2294.c | 48 ++++++++ OpenJudge/QuestionAns/peerin/2295.c | 51 ++++++++ OpenJudge/QuestionAns/peerin/2296.c | 66 ++++++++++ OpenJudge/QuestionAns/peerin/2297.c | 37 ++++++ OpenJudge/QuestionAns/peerin/2298.c | 28 +++++ OpenJudge/QuestionAns/peerin/2300.c | 41 +++++++ OpenJudge/QuestionAns/peerin/2301.c | 61 +++++++++ OpenJudge/QuestionAns/peerin/2302.c | 40 ++++++ OpenJudge/QuestionAns/peerin/2410.c | 20 +++ OpenJudge/QuestionAns/peerin/2411.c | 23 ++++ OpenJudge/QuestionAns/peerin/2412.c | 20 +++ OpenJudge/QuestionAns/peerin/2413.c | 30 +++++ OpenJudge/QuestionAns/peerin/2414.c | 29 +++++ OpenJudge/QuestionAns/peerin/2415.c | 29 +++++ OpenJudge/QuestionAns/peerin/2416.c | 34 +++++ OpenJudge/QuestionAns/peerin/2417.c | 45 +++++++ OpenJudge/QuestionAns/peerin/2419.c | 44 +++++++ OpenJudge/QuestionAns/peerin/2420.c | 24 ++++ OpenJudge/QuestionAns/peerin/2421.c | 33 +++++ OpenJudge/QuestionAns/peerin/2422.c | 34 +++++ OpenJudge/QuestionAns/peerin/2423.c | 138 +++++++++++++++++++++ OpenJudge/QuestionAns/peerin/2424.c | 23 ++++ OpenJudge/QuestionAns/peerin/2509.c | 18 +++ OpenJudge/QuestionAns/peerin/2509.cc | 19 +++ OpenJudge/QuestionAns/peerin/2510.c | 20 +++ OpenJudge/QuestionAns/peerin/2511.c | 39 ++++++ OpenJudge/QuestionAns/peerin/2512.c | 26 ++++ OpenJudge/QuestionAns/peerin/2513.c | 38 ++++++ OpenJudge/QuestionAns/peerin/2514.c | 49 ++++++++ OpenJudge/QuestionAns/peerin/2515.c | 23 ++++ OpenJudge/QuestionAns/peerin/2516.c | 32 +++++ OpenJudge/QuestionAns/peerin/2517.c | 52 ++++++++ OpenJudge/QuestionAns/peerin/2518.c | 28 +++++ OpenJudge/QuestionAns/peerin/2519.c | 29 +++++ OpenJudge/QuestionAns/peerin/2520.c | 21 ++++ OpenJudge/QuestionAns/peerin/2521.c | 29 +++++ OpenJudge/QuestionAns/peerin/2522.c | 31 +++++ OpenJudge/QuestionAns/peerin/2523.c | 66 ++++++++++ OpenJudge/QuestionAns/peerin/2598.c | 29 +++++ OpenJudge/QuestionAns/peerin/2599.c | 38 ++++++ OpenJudge/QuestionAns/peerin/2600.c | 31 +++++ OpenJudge/QuestionAns/peerin/2601.c | 34 +++++ OpenJudge/QuestionAns/peerin/2602.c | 40 ++++++ OpenJudge/QuestionAns/peerin/2606.c | 58 +++++++++ OpenJudge/QuestionAns/peerin/2608.c | 32 +++++ OpenJudge/QuestionAns/peerin/2610.c | 46 +++++++ OpenJudge/QuestionAns/peerin/2611.c | 175 ++++++++++++++++++++++++++ OpenJudge/QuestionAns/peerin/2614.c | 26 ++++ OpenJudge/QuestionAns/peerin/2615.c | 20 +++ OpenJudge/QuestionAns/peerin/2616.c | 21 ++++ OpenJudge/QuestionAns/peerin/2617.c | 24 ++++ OpenJudge/QuestionAns/peerin/2617.cc | 24 ++++ OpenJudge/QuestionAns/peerin/2618.c | 30 +++++ OpenJudge/QuestionAns/peerin/2619.c | 35 ++++++ OpenJudge/QuestionAns/peerin/2620.c | 49 ++++++++ OpenJudge/QuestionAns/peerin/2621.c | 31 +++++ OpenJudge/QuestionAns/peerin/2622.c | 31 +++++ OpenJudge/QuestionAns/peerin/2623.c | 45 +++++++ OpenJudge/QuestionAns/peerin/2624.c | 62 ++++++++++ OpenJudge/QuestionAns/peerin/2625.c | 38 ++++++ OpenJudge/QuestionAns/peerin/2675.c | 61 +++++++++ OpenJudge/QuestionAns/peerin/2683.c | 20 +++ OpenJudge/QuestionAns/peerin/2684.c | 24 ++++ OpenJudge/QuestionAns/peerin/2685.c | 27 ++++ OpenJudge/QuestionAns/peerin/2686.c | 25 ++++ OpenJudge/QuestionAns/peerin/2687.c | 34 +++++ OpenJudge/QuestionAns/peerin/2688.c | 49 ++++++++ OpenJudge/QuestionAns/peerin/2689.c | 34 +++++ OpenJudge/QuestionAns/peerin/2690.c | 36 ++++++ OpenJudge/QuestionAns/peerin/2691.c | 31 +++++ OpenJudge/QuestionAns/peerin/2692.c | 20 +++ OpenJudge/oh_my_code.py | 12 +- OpenJudge/oh_my_problem.py | 10 +- ProblemSet/1008/input | 4 +- ProblemSet/1008/output | 4 +- ProblemSet/1008/problem.md | 9 +- ProblemSet/1073/input | 5 + ProblemSet/1073/output | 24 ++++ ProblemSet/1073/problem.md | 71 +++++++++++ ProblemSet/1103/input | 1 + ProblemSet/1103/output | 1 + ProblemSet/1103/problem.md | 26 ++++ ProblemSet/1134/problem.md | 2 +- ProblemSet/1179/problem.md | 2 +- ProblemSet/1212/input | 1 + ProblemSet/1212/output | 1 + ProblemSet/1212/problem.md | 33 +++++ ProblemSet/1236/problem.md | 2 +- ProblemSet/1490/input | 2 + ProblemSet/1490/output | 2 + ProblemSet/1490/problem.md | 33 +++++ ProblemSet/1494/problem.md | 2 +- ProblemSet/1503/problem.md | 2 +- ProblemSet/1607/problem.md | 10 +- ProblemSet/1634/problem.md | 3 +- ProblemSet/1837/input | 7 ++ ProblemSet/1837/output | 3 + ProblemSet/1837/problem.md | 33 +++++ ProblemSet/1840/input | 3 + ProblemSet/1840/output | 4 + ProblemSet/1840/problem.md | 31 +++++ ProblemSet/1881/input | 1 + ProblemSet/1881/output | 2 + ProblemSet/1881/problem.md | 44 +++++++ ProblemSet/2026/problem.md | 2 +- ProblemSet/2294/problem.md | 2 +- ProblemSet/2298/problem.md | 2 +- ProblemSet/2509/input | 0 ProblemSet/2509/output | 0 ProblemSet/2509/problem.md | 26 ++++ ProblemSet/2510/input | 1 + ProblemSet/2510/output | 1 + ProblemSet/2510/problem.md | 27 ++++ ProblemSet/2511/input | 1 + ProblemSet/2511/output | 1 + ProblemSet/2511/problem.md | 32 +++++ ProblemSet/2512/input | 1 + ProblemSet/2512/output | 1 + ProblemSet/2512/problem.md | 27 ++++ ProblemSet/2513/input | 3 + ProblemSet/2513/output | 1 + ProblemSet/2513/problem.md | 30 +++++ ProblemSet/2514/input | 6 + ProblemSet/2514/output | 3 + ProblemSet/2514/problem.md | 36 ++++++ ProblemSet/2515/input | 1 + ProblemSet/2515/output | 1 + ProblemSet/2515/problem.md | 54 ++++++++ ProblemSet/2516/input | 2 + ProblemSet/2516/output | 2 + ProblemSet/2516/problem.md | 61 +++++++++ ProblemSet/2517/input | 2 + ProblemSet/2517/output | 2 + ProblemSet/2517/problem.md | 61 +++++++++ ProblemSet/2518/input | 1 + ProblemSet/2518/output | 1 + ProblemSet/2518/problem.md | 59 +++++++++ ProblemSet/2519/input | 1 + ProblemSet/2519/output | 1 + ProblemSet/2519/problem.md | 60 +++++++++ ProblemSet/2520/input | 1 + ProblemSet/2520/output | 1 + ProblemSet/2520/problem.md | 27 ++++ ProblemSet/2521/input | 1 + ProblemSet/2521/output | 1 + ProblemSet/2521/problem.md | 32 +++++ ProblemSet/2522/input | 10 ++ ProblemSet/2522/output | 10 ++ ProblemSet/2522/problem.md | 49 ++++++++ ProblemSet/2523/input | 2 + ProblemSet/2523/output | 2 + ProblemSet/2523/problem.md | 35 ++++++ ProblemSet/2598/input | 3 + ProblemSet/2598/output | 2 + ProblemSet/2598/problem.md | 60 +++++++++ ProblemSet/2599/input | 3 + ProblemSet/2599/output | 3 + ProblemSet/2599/problem.md | 35 ++++++ ProblemSet/2600/input | 1 + ProblemSet/2600/output | 1 + ProblemSet/2600/problem.md | 53 ++++++++ ProblemSet/2601/input | 1 + ProblemSet/2601/output | 1 + ProblemSet/2601/problem.md | 57 +++++++++ ProblemSet/2602/input | 1 + ProblemSet/2602/output | 1 + ProblemSet/2602/problem.md | 32 +++++ ProblemSet/2606/input | 1 + ProblemSet/2606/output | 1 + ProblemSet/2606/problem.md | 34 +++++ ProblemSet/2608/input | 1 + ProblemSet/2608/output | 1 + ProblemSet/2608/problem.md | 35 ++++++ ProblemSet/2610/input | 1 + ProblemSet/2610/output | 5 + ProblemSet/2610/problem.md | 48 ++++++++ ProblemSet/2611/input | 4 + ProblemSet/2611/output | 4 + ProblemSet/2611/problem.md | 97 +++++++++++++++ ProblemSet/2614/input | 0 ProblemSet/2614/output | 0 ProblemSet/2614/problem.md | 34 +++++ ProblemSet/2615/input | 1 + ProblemSet/2615/output | 1 + ProblemSet/2615/problem.md | 28 +++++ ProblemSet/2616/input | 1 + ProblemSet/2616/output | 1 + ProblemSet/2616/problem.md | 34 +++++ ProblemSet/2617/input | 1 + ProblemSet/2617/output | 1 + ProblemSet/2617/problem.md | 26 ++++ ProblemSet/2618/input | 2 + ProblemSet/2618/output | 1 + ProblemSet/2618/problem.md | 28 +++++ ProblemSet/2619/input | 9 ++ ProblemSet/2619/output | 3 + ProblemSet/2619/problem.md | 39 ++++++ ProblemSet/2620/input | 1 + ProblemSet/2620/output | 1 + ProblemSet/2620/problem.md | 45 +++++++ ProblemSet/2621/input | 1 + ProblemSet/2621/output | 1 + ProblemSet/2621/problem.md | 50 ++++++++ ProblemSet/2622/input | 3 + ProblemSet/2622/output | 1 + ProblemSet/2622/problem.md | 53 ++++++++ ProblemSet/2623/input | 1 + ProblemSet/2623/output | 2 + ProblemSet/2623/problem.md | 51 ++++++++ ProblemSet/2624/input | 6 + ProblemSet/2624/output | 5 + ProblemSet/2624/problem.md | 62 ++++++++++ ProblemSet/2625/input | 4 + ProblemSet/2625/output | 4 + ProblemSet/2625/problem.md | 34 +++++ ProblemSet/2675/input | 3 + ProblemSet/2675/output | 3 + ProblemSet/2675/problem.md | 33 +++++ ProblemSet/2676/input | 11 ++ ProblemSet/2676/output | 1 + ProblemSet/2676/problem.md | 37 ++++++ ProblemSet/2677/input | 1 + ProblemSet/2677/output | 1 + ProblemSet/2677/problem.md | 26 ++++ ProblemSet/2678/input | 1 + ProblemSet/2678/output | 1 + ProblemSet/2678/problem.md | 30 +++++ ProblemSet/2679/input | 7 ++ ProblemSet/2679/output | 7 ++ ProblemSet/2679/problem.md | 40 ++++++ QuestionAns/peerin/1001.c | 15 +++ QuestionAns/peerin/1002.c | 18 +++ QuestionAns/peerin/1003.c | 18 +++ QuestionAns/peerin/1004.c | 18 +++ QuestionAns/peerin/1005.c | 19 +++ QuestionAns/peerin/1006.c | 20 +++ QuestionAns/peerin/1007.c | 19 +++ QuestionAns/peerin/1008.c | 23 ++++ QuestionAns/peerin/1009.c | 21 ++++ QuestionAns/peerin/1010.c | 18 +++ QuestionAns/peerin/1012.c | 34 +++++ QuestionAns/peerin/1013.c | 36 ++++++ QuestionAns/peerin/1014.c | 36 ++++++ QuestionAns/peerin/1015.c | 38 ++++++ QuestionAns/peerin/1016.c | 20 +++ QuestionAns/peerin/1017.c | 42 +++++++ QuestionAns/peerin/1018.c | 31 +++++ QuestionAns/peerin/1019.c | 49 ++++++++ QuestionAns/peerin/1020.c | 24 ++++ QuestionAns/peerin/1021.c | 25 ++++ QuestionAns/peerin/1022.c | 25 ++++ QuestionAns/peerin/1023.c | 24 ++++ QuestionAns/peerin/1024.c | 33 +++++ QuestionAns/peerin/1025.c | 68 ++++++++++ QuestionAns/peerin/1027.c | 37 ++++++ QuestionAns/peerin/1028.c | 56 +++++++++ QuestionAns/peerin/1041.c | 84 +++++++++++++ QuestionAns/peerin/1042.c | 25 ++++ QuestionAns/peerin/1043.c | 27 ++++ QuestionAns/peerin/1044.c | 25 ++++ QuestionAns/peerin/1045.c | 27 ++++ QuestionAns/peerin/1046.c | 40 ++++++ QuestionAns/peerin/1047.c | 27 ++++ QuestionAns/peerin/1048.c | 58 +++++++++ QuestionAns/peerin/1049.c | 71 +++++++++++ QuestionAns/peerin/1050.c | 55 +++++++++ QuestionAns/peerin/1051.c | 48 ++++++++ QuestionAns/peerin/1052.c | 97 +++++++++++++++ QuestionAns/peerin/1053.c | 66 ++++++++++ QuestionAns/peerin/1054.c | 49 ++++++++ QuestionAns/peerin/1055.c | 92 ++++++++++++++ QuestionAns/peerin/1060.c | 104 ++++++++++++++++ QuestionAns/peerin/1061.c | 62 ++++++++++ QuestionAns/peerin/1062.c | 72 +++++++++++ QuestionAns/peerin/1068.c | 81 ++++++++++++ QuestionAns/peerin/1078.c | 71 +++++++++++ QuestionAns/peerin/1079.c | 23 ++++ QuestionAns/peerin/1088.c | 25 ++++ QuestionAns/peerin/1092.c | 26 ++++ QuestionAns/peerin/1093.c | 39 ++++++ QuestionAns/peerin/1094.c | 61 +++++++++ QuestionAns/peerin/1095.c | 34 +++++ QuestionAns/peerin/1097.c | 31 +++++ QuestionAns/peerin/1098.c | 25 ++++ QuestionAns/peerin/1099.c | 45 +++++++ QuestionAns/peerin/1100.c | 43 +++++++ QuestionAns/peerin/1101.c | 31 +++++ QuestionAns/peerin/1107.c | 53 ++++++++ QuestionAns/peerin/1133.c | 50 ++++++++ QuestionAns/peerin/1134.c | 63 ++++++++++ QuestionAns/peerin/1135.c | 83 +++++++++++++ QuestionAns/peerin/1136.c | 177 +++++++++++++++++++++++++++ QuestionAns/peerin/1138.c | 28 +++++ QuestionAns/peerin/1139.c | 35 ++++++ QuestionAns/peerin/1140.c | 78 ++++++++++++ QuestionAns/peerin/1141.c | 105 ++++++++++++++++ QuestionAns/peerin/1144.c | 63 ++++++++++ QuestionAns/peerin/1145.c | 30 +++++ QuestionAns/peerin/1146.c | 58 +++++++++ QuestionAns/peerin/1149.c | 30 +++++ QuestionAns/peerin/1153.c | 64 ++++++++++ QuestionAns/peerin/1155.c | 47 +++++++ QuestionAns/peerin/1158.c | 18 +++ QuestionAns/peerin/1162.c | 42 +++++++ QuestionAns/peerin/1163.c | 46 +++++++ QuestionAns/peerin/1167.c | 43 +++++++ QuestionAns/peerin/1168.c | 43 +++++++ QuestionAns/peerin/1169.c | 55 +++++++++ QuestionAns/peerin/1172.c | 71 +++++++++++ QuestionAns/peerin/1176.c | 43 +++++++ QuestionAns/peerin/1178.c | 42 +++++++ QuestionAns/peerin/1179.c | 76 ++++++++++++ QuestionAns/peerin/1180.c | 64 ++++++++++ QuestionAns/peerin/1184.c | 43 +++++++ QuestionAns/peerin/1187.c | 45 +++++++ QuestionAns/peerin/1189.c | 29 +++++ QuestionAns/peerin/1200.c | 31 +++++ QuestionAns/peerin/1206.c | 31 +++++ QuestionAns/peerin/1207.c | 35 ++++++ QuestionAns/peerin/1208.c | 52 ++++++++ QuestionAns/peerin/1212.c | 55 +++++++++ QuestionAns/peerin/1213.c | 43 +++++++ QuestionAns/peerin/1214.c | 47 +++++++ QuestionAns/peerin/1215.c | 33 +++++ QuestionAns/peerin/1216.c | 36 ++++++ QuestionAns/peerin/1217.c | 37 ++++++ QuestionAns/peerin/1220.c | 58 +++++++++ QuestionAns/peerin/1221.c | 54 ++++++++ QuestionAns/peerin/1224.c | 28 +++++ QuestionAns/peerin/1228.c | 70 +++++++++++ QuestionAns/peerin/1233.c | 55 +++++++++ QuestionAns/peerin/1234.c | 32 +++++ QuestionAns/peerin/1235.c | 32 +++++ QuestionAns/peerin/1236.c | 32 +++++ QuestionAns/peerin/1238.c | 18 +++ QuestionAns/peerin/1240.c | 26 ++++ QuestionAns/peerin/1241.c | 38 ++++++ QuestionAns/peerin/1242.c | 44 +++++++ QuestionAns/peerin/1244.c | 24 ++++ QuestionAns/peerin/1245.c | 39 ++++++ QuestionAns/peerin/1247.c | 53 ++++++++ QuestionAns/peerin/1250.c | 29 +++++ QuestionAns/peerin/1251.c | 27 ++++ QuestionAns/peerin/1252.c | 18 +++ QuestionAns/peerin/1253.c | 28 +++++ QuestionAns/peerin/1254.c | 63 ++++++++++ QuestionAns/peerin/1255.c | 54 ++++++++ QuestionAns/peerin/1268.c | 75 ++++++++++++ QuestionAns/peerin/1271.c | 127 +++++++++++++++++++ QuestionAns/peerin/1276.c | 70 +++++++++++ QuestionAns/peerin/1278.c | 41 +++++++ QuestionAns/peerin/1286.c | 60 +++++++++ QuestionAns/peerin/1298.c | 32 +++++ QuestionAns/peerin/1301.c | 92 ++++++++++++++ QuestionAns/peerin/1334.c | 39 ++++++ QuestionAns/peerin/1337.c | 34 +++++ QuestionAns/peerin/1347.c | 54 ++++++++ QuestionAns/peerin/1368.c | 55 +++++++++ QuestionAns/peerin/1370.c | 43 +++++++ QuestionAns/peerin/1375.c | 25 ++++ QuestionAns/peerin/1376.c | 51 ++++++++ QuestionAns/peerin/1382.c | 52 ++++++++ QuestionAns/peerin/1383.c | 69 +++++++++++ QuestionAns/peerin/1384.c | 30 +++++ QuestionAns/peerin/1398.c | 19 +++ QuestionAns/peerin/1400.c | 18 +++ QuestionAns/peerin/1403.c | 27 ++++ QuestionAns/peerin/1404.c | 25 ++++ QuestionAns/peerin/1416.c | 25 ++++ QuestionAns/peerin/1417.c | 24 ++++ QuestionAns/peerin/1434.c | 65 ++++++++++ QuestionAns/peerin/1455.c | 27 ++++ QuestionAns/peerin/1457.c | 55 +++++++++ QuestionAns/peerin/1458.c | 32 +++++ QuestionAns/peerin/1459.c | 54 ++++++++ QuestionAns/peerin/1460.c | 45 +++++++ QuestionAns/peerin/1461.c | 36 ++++++ QuestionAns/peerin/1462.c | 60 +++++++++ QuestionAns/peerin/1463.c | 28 +++++ QuestionAns/peerin/1464.c | 26 ++++ QuestionAns/peerin/1465.c | 27 ++++ QuestionAns/peerin/1466.c | 27 ++++ QuestionAns/peerin/1468.c | 99 +++++++++++++++ QuestionAns/peerin/1469.c | 30 +++++ QuestionAns/peerin/1473.c | 46 +++++++ QuestionAns/peerin/1487.c | 38 ++++++ QuestionAns/peerin/1490.c | 48 ++++++++ QuestionAns/peerin/1494.c | 36 ++++++ QuestionAns/peerin/1495.c | 36 ++++++ QuestionAns/peerin/1497.c | 66 ++++++++++ QuestionAns/peerin/1503.c | 65 ++++++++++ QuestionAns/peerin/1508.c | 58 +++++++++ QuestionAns/peerin/1509.c | 45 +++++++ QuestionAns/peerin/1511.c | 66 ++++++++++ QuestionAns/peerin/1512.c | 32 +++++ QuestionAns/peerin/1561.c | 59 +++++++++ QuestionAns/peerin/1586.c | 56 +++++++++ QuestionAns/peerin/1593.c | 62 ++++++++++ QuestionAns/peerin/1607.c | 29 +++++ QuestionAns/peerin/1611.c | 37 ++++++ QuestionAns/peerin/1633.c | 51 ++++++++ QuestionAns/peerin/1634.c | 93 ++++++++++++++ QuestionAns/peerin/1637.c | 79 ++++++++++++ QuestionAns/peerin/1653.c | 38 ++++++ QuestionAns/peerin/1764.c | 36 ++++++ QuestionAns/peerin/1766.c | 55 +++++++++ QuestionAns/peerin/1769.c | 32 +++++ QuestionAns/peerin/1837.c | 52 ++++++++ QuestionAns/peerin/1840.c | 79 ++++++++++++ QuestionAns/peerin/1897.c | 36 ++++++ QuestionAns/peerin/1937.c | 46 +++++++ QuestionAns/peerin/2025.c | 20 +++ QuestionAns/peerin/2026.c | 69 +++++++++++ QuestionAns/peerin/2033.c | 33 +++++ QuestionAns/peerin/2036.c | 32 +++++ QuestionAns/peerin/2038.c | 42 +++++++ QuestionAns/peerin/2039.c | 68 ++++++++++ QuestionAns/peerin/2040.c | 18 +++ QuestionAns/peerin/2041.c | 64 ++++++++++ QuestionAns/peerin/2042.c | 49 ++++++++ QuestionAns/peerin/2043.c | 40 ++++++ QuestionAns/peerin/2045.c | 65 ++++++++++ QuestionAns/peerin/2046.c | 32 +++++ QuestionAns/peerin/2293.c | 58 +++++++++ QuestionAns/peerin/2294.c | 48 ++++++++ QuestionAns/peerin/2295.c | 51 ++++++++ QuestionAns/peerin/2296.c | 66 ++++++++++ QuestionAns/peerin/2297.c | 37 ++++++ QuestionAns/peerin/2298.c | 28 +++++ QuestionAns/peerin/2300.c | 41 +++++++ QuestionAns/peerin/2301.c | 61 +++++++++ QuestionAns/peerin/2302.c | 40 ++++++ QuestionAns/peerin/2413.c | 36 ++++++ QuestionAns/peerin/2414.c | 28 +++++ QuestionAns/peerin/2415.c | 28 +++++ QuestionAns/peerin/2421.c | 53 ++++++++ QuestionAns/peerin/2509.cc | 19 +++ QuestionAns/peerin/2598.c | 29 +++++ QuestionAns/peerin/2599.c | 38 ++++++ QuestionAns/peerin/2600.c | 31 +++++ QuestionAns/peerin/2601.c | 34 +++++ QuestionAns/peerin/2602.c | 40 ++++++ QuestionAns/peerin/2606.c | 58 +++++++++ QuestionAns/peerin/2608.c | 32 +++++ QuestionAns/peerin/2610.c | 46 +++++++ QuestionAns/peerin/2611.c | 175 ++++++++++++++++++++++++++ QuestionAns/peerin/2614.c | 26 ++++ QuestionAns/peerin/2615.c | 20 +++ QuestionAns/peerin/2616.c | 21 ++++ QuestionAns/peerin/2617.c | 24 ++++ QuestionAns/peerin/2617.cc | 24 ++++ QuestionAns/peerin/2618.c | 30 +++++ QuestionAns/peerin/2619.c | 35 ++++++ QuestionAns/peerin/2620.c | 49 ++++++++ QuestionAns/peerin/2621.c | 31 +++++ QuestionAns/peerin/2622.c | 31 +++++ QuestionAns/peerin/2623.c | 45 +++++++ QuestionAns/peerin/2624.c | 63 ++++++++++ QuestionAns/peerin/2625.c | 36 ++++++ QuestionAns/peerin/2675.c | 61 +++++++++ 694 files changed, 24801 insertions(+), 35 deletions(-) create mode 100644 OpenJudge/ProblemSet/1510/input create mode 100644 OpenJudge/ProblemSet/1510/output create mode 100644 OpenJudge/ProblemSet/1510/problem.md create mode 100644 OpenJudge/ProblemSet/2683/input create mode 100644 OpenJudge/ProblemSet/2683/output create mode 100644 OpenJudge/ProblemSet/2683/problem.md create mode 100644 OpenJudge/ProblemSet/2684/input create mode 100644 OpenJudge/ProblemSet/2684/output create mode 100644 OpenJudge/ProblemSet/2684/problem.md create mode 100644 OpenJudge/ProblemSet/2685/input create mode 100644 OpenJudge/ProblemSet/2685/output create mode 100644 OpenJudge/ProblemSet/2685/problem.md create mode 100644 OpenJudge/ProblemSet/2686/input create mode 100644 OpenJudge/ProblemSet/2686/output create mode 100644 OpenJudge/ProblemSet/2686/problem.md create mode 100644 OpenJudge/ProblemSet/2687/input create mode 100644 OpenJudge/ProblemSet/2687/output create mode 100644 OpenJudge/ProblemSet/2687/problem.md create mode 100644 OpenJudge/ProblemSet/2688/input create mode 100644 OpenJudge/ProblemSet/2688/output create mode 100644 OpenJudge/ProblemSet/2688/problem.md create mode 100644 OpenJudge/ProblemSet/2689/input create mode 100644 OpenJudge/ProblemSet/2689/output create mode 100644 OpenJudge/ProblemSet/2689/problem.md create mode 100644 OpenJudge/ProblemSet/2690/input create mode 100644 OpenJudge/ProblemSet/2690/output create mode 100644 OpenJudge/ProblemSet/2690/problem.md create mode 100644 OpenJudge/ProblemSet/2691/input create mode 100644 OpenJudge/ProblemSet/2691/output create mode 100644 OpenJudge/ProblemSet/2691/problem.md create mode 100644 OpenJudge/ProblemSet/2692/input create mode 100644 OpenJudge/ProblemSet/2692/output create mode 100644 OpenJudge/ProblemSet/2692/problem.md create mode 100644 OpenJudge/ProblemSet/2693/input create mode 100644 OpenJudge/ProblemSet/2693/output create mode 100644 OpenJudge/ProblemSet/2693/problem.md create mode 100644 OpenJudge/ProblemSet/2694/input create mode 100644 OpenJudge/ProblemSet/2694/output create mode 100644 OpenJudge/ProblemSet/2694/problem.md create mode 100644 OpenJudge/QuestionAns/peerin/1001.c create mode 100644 OpenJudge/QuestionAns/peerin/1002.c create mode 100644 OpenJudge/QuestionAns/peerin/1003.c create mode 100644 OpenJudge/QuestionAns/peerin/1004.c create mode 100644 OpenJudge/QuestionAns/peerin/1005.c create mode 100644 OpenJudge/QuestionAns/peerin/1006.c create mode 100644 OpenJudge/QuestionAns/peerin/1007.c create mode 100644 OpenJudge/QuestionAns/peerin/1008.c create mode 100644 OpenJudge/QuestionAns/peerin/1009.c create mode 100644 OpenJudge/QuestionAns/peerin/1010.c create mode 100644 OpenJudge/QuestionAns/peerin/1012.c create mode 100644 OpenJudge/QuestionAns/peerin/1013.c create mode 100644 OpenJudge/QuestionAns/peerin/1014.c create mode 100644 OpenJudge/QuestionAns/peerin/1015.c create mode 100644 OpenJudge/QuestionAns/peerin/1016.c create mode 100644 OpenJudge/QuestionAns/peerin/1017.c create mode 100644 OpenJudge/QuestionAns/peerin/1018.c create mode 100644 OpenJudge/QuestionAns/peerin/1019.c create mode 100644 OpenJudge/QuestionAns/peerin/1020.c create mode 100644 OpenJudge/QuestionAns/peerin/1021.c create mode 100644 OpenJudge/QuestionAns/peerin/1022.c create mode 100644 OpenJudge/QuestionAns/peerin/1023.c create mode 100644 OpenJudge/QuestionAns/peerin/1024.c create mode 100644 OpenJudge/QuestionAns/peerin/1025.c create mode 100644 OpenJudge/QuestionAns/peerin/1027.c create mode 100644 OpenJudge/QuestionAns/peerin/1028.c create mode 100644 OpenJudge/QuestionAns/peerin/1041.c create mode 100644 OpenJudge/QuestionAns/peerin/1042.c create mode 100644 OpenJudge/QuestionAns/peerin/1043.c create mode 100644 OpenJudge/QuestionAns/peerin/1044.c create mode 100644 OpenJudge/QuestionAns/peerin/1045.c create mode 100644 OpenJudge/QuestionAns/peerin/1046.c create mode 100644 OpenJudge/QuestionAns/peerin/1047.c create mode 100644 OpenJudge/QuestionAns/peerin/1048.c create mode 100644 OpenJudge/QuestionAns/peerin/1049.c create mode 100644 OpenJudge/QuestionAns/peerin/1050.c create mode 100644 OpenJudge/QuestionAns/peerin/1051.c create mode 100644 OpenJudge/QuestionAns/peerin/1052.c create mode 100644 OpenJudge/QuestionAns/peerin/1053.c create mode 100644 OpenJudge/QuestionAns/peerin/1054.c create mode 100644 OpenJudge/QuestionAns/peerin/1055.c create mode 100644 OpenJudge/QuestionAns/peerin/1060.c create mode 100644 OpenJudge/QuestionAns/peerin/1061.c create mode 100644 OpenJudge/QuestionAns/peerin/1062.c create mode 100644 OpenJudge/QuestionAns/peerin/1068.c create mode 100644 OpenJudge/QuestionAns/peerin/1078.c create mode 100644 OpenJudge/QuestionAns/peerin/1079.c create mode 100644 OpenJudge/QuestionAns/peerin/1088.c create mode 100644 OpenJudge/QuestionAns/peerin/1092.c create mode 100644 OpenJudge/QuestionAns/peerin/1093.c create mode 100644 OpenJudge/QuestionAns/peerin/1094.c create mode 100644 OpenJudge/QuestionAns/peerin/1095.c create mode 100644 OpenJudge/QuestionAns/peerin/1097.c create mode 100644 OpenJudge/QuestionAns/peerin/1098.c create mode 100644 OpenJudge/QuestionAns/peerin/1099.c create mode 100644 OpenJudge/QuestionAns/peerin/1100.c create mode 100644 OpenJudge/QuestionAns/peerin/1101.c create mode 100644 OpenJudge/QuestionAns/peerin/1107.c create mode 100644 OpenJudge/QuestionAns/peerin/1133.c create mode 100644 OpenJudge/QuestionAns/peerin/1134.c create mode 100644 OpenJudge/QuestionAns/peerin/1135.c create mode 100644 OpenJudge/QuestionAns/peerin/1136.c create mode 100644 OpenJudge/QuestionAns/peerin/1138.c create mode 100644 OpenJudge/QuestionAns/peerin/1139.c create mode 100644 OpenJudge/QuestionAns/peerin/1140.c create mode 100644 OpenJudge/QuestionAns/peerin/1141.c create mode 100644 OpenJudge/QuestionAns/peerin/1144.c create mode 100644 OpenJudge/QuestionAns/peerin/1145.c create mode 100644 OpenJudge/QuestionAns/peerin/1146.c create mode 100644 OpenJudge/QuestionAns/peerin/1149.c create mode 100644 OpenJudge/QuestionAns/peerin/1153.c create mode 100644 OpenJudge/QuestionAns/peerin/1155.c create mode 100644 OpenJudge/QuestionAns/peerin/1158.c create mode 100644 OpenJudge/QuestionAns/peerin/1162.c create mode 100644 OpenJudge/QuestionAns/peerin/1163.c create mode 100644 OpenJudge/QuestionAns/peerin/1167.c create mode 100644 OpenJudge/QuestionAns/peerin/1168.c create mode 100644 OpenJudge/QuestionAns/peerin/1169.c create mode 100644 OpenJudge/QuestionAns/peerin/1172.c create mode 100644 OpenJudge/QuestionAns/peerin/1176.c create mode 100644 OpenJudge/QuestionAns/peerin/1178.c create mode 100644 OpenJudge/QuestionAns/peerin/1179.c create mode 100644 OpenJudge/QuestionAns/peerin/1180.c create mode 100644 OpenJudge/QuestionAns/peerin/1184.c create mode 100644 OpenJudge/QuestionAns/peerin/1187.c create mode 100644 OpenJudge/QuestionAns/peerin/1189.c create mode 100644 OpenJudge/QuestionAns/peerin/1200.c create mode 100644 OpenJudge/QuestionAns/peerin/1206.c create mode 100644 OpenJudge/QuestionAns/peerin/1207.c create mode 100644 OpenJudge/QuestionAns/peerin/1208.c create mode 100644 OpenJudge/QuestionAns/peerin/1212.c create mode 100644 OpenJudge/QuestionAns/peerin/1213.c create mode 100644 OpenJudge/QuestionAns/peerin/1214.c create mode 100644 OpenJudge/QuestionAns/peerin/1215.c create mode 100644 OpenJudge/QuestionAns/peerin/1216.c create mode 100644 OpenJudge/QuestionAns/peerin/1217.c create mode 100644 OpenJudge/QuestionAns/peerin/1220.c create mode 100644 OpenJudge/QuestionAns/peerin/1221.c create mode 100644 OpenJudge/QuestionAns/peerin/1224.c create mode 100644 OpenJudge/QuestionAns/peerin/1228.c create mode 100644 OpenJudge/QuestionAns/peerin/1233.c create mode 100644 OpenJudge/QuestionAns/peerin/1234.c create mode 100644 OpenJudge/QuestionAns/peerin/1235.c create mode 100644 OpenJudge/QuestionAns/peerin/1236.c create mode 100644 OpenJudge/QuestionAns/peerin/1238.c create mode 100644 OpenJudge/QuestionAns/peerin/1240.c create mode 100644 OpenJudge/QuestionAns/peerin/1241.c create mode 100644 OpenJudge/QuestionAns/peerin/1242.c create mode 100644 OpenJudge/QuestionAns/peerin/1244.c create mode 100644 OpenJudge/QuestionAns/peerin/1245.c create mode 100644 OpenJudge/QuestionAns/peerin/1247.c create mode 100644 OpenJudge/QuestionAns/peerin/1250.c create mode 100644 OpenJudge/QuestionAns/peerin/1251.c create mode 100644 OpenJudge/QuestionAns/peerin/1252.c create mode 100644 OpenJudge/QuestionAns/peerin/1253.c create mode 100644 OpenJudge/QuestionAns/peerin/1254.c create mode 100644 OpenJudge/QuestionAns/peerin/1255.c create mode 100644 OpenJudge/QuestionAns/peerin/1268.c create mode 100644 OpenJudge/QuestionAns/peerin/1271.c create mode 100644 OpenJudge/QuestionAns/peerin/1276.c create mode 100644 OpenJudge/QuestionAns/peerin/1278.c create mode 100644 OpenJudge/QuestionAns/peerin/1286.c create mode 100644 OpenJudge/QuestionAns/peerin/1298.c create mode 100644 OpenJudge/QuestionAns/peerin/1301.c create mode 100644 OpenJudge/QuestionAns/peerin/1334.c create mode 100644 OpenJudge/QuestionAns/peerin/1337.c create mode 100644 OpenJudge/QuestionAns/peerin/1347.c create mode 100644 OpenJudge/QuestionAns/peerin/1368.c create mode 100644 OpenJudge/QuestionAns/peerin/1370.c create mode 100644 OpenJudge/QuestionAns/peerin/1375.c create mode 100644 OpenJudge/QuestionAns/peerin/1376.c create mode 100644 OpenJudge/QuestionAns/peerin/1382.c create mode 100644 OpenJudge/QuestionAns/peerin/1383.c create mode 100644 OpenJudge/QuestionAns/peerin/1384.c create mode 100644 OpenJudge/QuestionAns/peerin/1398.c create mode 100644 OpenJudge/QuestionAns/peerin/1400.c create mode 100644 OpenJudge/QuestionAns/peerin/1403.c create mode 100644 OpenJudge/QuestionAns/peerin/1404.c create mode 100644 OpenJudge/QuestionAns/peerin/1416.c create mode 100644 OpenJudge/QuestionAns/peerin/1417.c create mode 100644 OpenJudge/QuestionAns/peerin/1434.c create mode 100644 OpenJudge/QuestionAns/peerin/1455.c create mode 100644 OpenJudge/QuestionAns/peerin/1457.c create mode 100644 OpenJudge/QuestionAns/peerin/1458.c create mode 100644 OpenJudge/QuestionAns/peerin/1459.c create mode 100644 OpenJudge/QuestionAns/peerin/1460.c create mode 100644 OpenJudge/QuestionAns/peerin/1461.c create mode 100644 OpenJudge/QuestionAns/peerin/1462.c create mode 100644 OpenJudge/QuestionAns/peerin/1463.c create mode 100644 OpenJudge/QuestionAns/peerin/1464.c create mode 100644 OpenJudge/QuestionAns/peerin/1465.c create mode 100644 OpenJudge/QuestionAns/peerin/1466.c create mode 100644 OpenJudge/QuestionAns/peerin/1468.c create mode 100644 OpenJudge/QuestionAns/peerin/1469.c create mode 100644 OpenJudge/QuestionAns/peerin/1473.c create mode 100644 OpenJudge/QuestionAns/peerin/1487.c create mode 100644 OpenJudge/QuestionAns/peerin/1490.c create mode 100644 OpenJudge/QuestionAns/peerin/1494.c create mode 100644 OpenJudge/QuestionAns/peerin/1495.c create mode 100644 OpenJudge/QuestionAns/peerin/1497.c create mode 100644 OpenJudge/QuestionAns/peerin/1503.c create mode 100644 OpenJudge/QuestionAns/peerin/1508.c create mode 100644 OpenJudge/QuestionAns/peerin/1509.c create mode 100644 OpenJudge/QuestionAns/peerin/1510.c create mode 100644 OpenJudge/QuestionAns/peerin/1511.c create mode 100644 OpenJudge/QuestionAns/peerin/1512.c create mode 100644 OpenJudge/QuestionAns/peerin/1561.c create mode 100644 OpenJudge/QuestionAns/peerin/1586.c create mode 100644 OpenJudge/QuestionAns/peerin/1593.c create mode 100644 OpenJudge/QuestionAns/peerin/1607.c create mode 100644 OpenJudge/QuestionAns/peerin/1611.c create mode 100644 OpenJudge/QuestionAns/peerin/1633.c create mode 100644 OpenJudge/QuestionAns/peerin/1634.c create mode 100644 OpenJudge/QuestionAns/peerin/1637.c create mode 100644 OpenJudge/QuestionAns/peerin/1653.c create mode 100644 OpenJudge/QuestionAns/peerin/1764.c create mode 100644 OpenJudge/QuestionAns/peerin/1766.c create mode 100644 OpenJudge/QuestionAns/peerin/1769.c create mode 100644 OpenJudge/QuestionAns/peerin/1837.c create mode 100644 OpenJudge/QuestionAns/peerin/1840.c create mode 100644 OpenJudge/QuestionAns/peerin/1897.c create mode 100644 OpenJudge/QuestionAns/peerin/1937.c create mode 100644 OpenJudge/QuestionAns/peerin/2025.c create mode 100644 OpenJudge/QuestionAns/peerin/2026.c create mode 100644 OpenJudge/QuestionAns/peerin/2033.c create mode 100644 OpenJudge/QuestionAns/peerin/2036.c create mode 100644 OpenJudge/QuestionAns/peerin/2038.c create mode 100644 OpenJudge/QuestionAns/peerin/2039.c create mode 100644 OpenJudge/QuestionAns/peerin/2040.c create mode 100644 OpenJudge/QuestionAns/peerin/2041.c create mode 100644 OpenJudge/QuestionAns/peerin/2042.c create mode 100644 OpenJudge/QuestionAns/peerin/2043.c create mode 100644 OpenJudge/QuestionAns/peerin/2045.c create mode 100644 OpenJudge/QuestionAns/peerin/2046.c create mode 100644 OpenJudge/QuestionAns/peerin/2293.c create mode 100644 OpenJudge/QuestionAns/peerin/2294.c create mode 100644 OpenJudge/QuestionAns/peerin/2295.c create mode 100644 OpenJudge/QuestionAns/peerin/2296.c create mode 100644 OpenJudge/QuestionAns/peerin/2297.c create mode 100644 OpenJudge/QuestionAns/peerin/2298.c create mode 100644 OpenJudge/QuestionAns/peerin/2300.c create mode 100644 OpenJudge/QuestionAns/peerin/2301.c create mode 100644 OpenJudge/QuestionAns/peerin/2302.c create mode 100644 OpenJudge/QuestionAns/peerin/2410.c create mode 100644 OpenJudge/QuestionAns/peerin/2411.c create mode 100644 OpenJudge/QuestionAns/peerin/2412.c create mode 100644 OpenJudge/QuestionAns/peerin/2413.c create mode 100644 OpenJudge/QuestionAns/peerin/2414.c create mode 100644 OpenJudge/QuestionAns/peerin/2415.c create mode 100644 OpenJudge/QuestionAns/peerin/2416.c create mode 100644 OpenJudge/QuestionAns/peerin/2417.c create mode 100644 OpenJudge/QuestionAns/peerin/2419.c create mode 100644 OpenJudge/QuestionAns/peerin/2420.c create mode 100644 OpenJudge/QuestionAns/peerin/2421.c create mode 100644 OpenJudge/QuestionAns/peerin/2422.c create mode 100644 OpenJudge/QuestionAns/peerin/2423.c create mode 100644 OpenJudge/QuestionAns/peerin/2424.c create mode 100644 OpenJudge/QuestionAns/peerin/2509.c create mode 100644 OpenJudge/QuestionAns/peerin/2509.cc create mode 100644 OpenJudge/QuestionAns/peerin/2510.c create mode 100644 OpenJudge/QuestionAns/peerin/2511.c create mode 100644 OpenJudge/QuestionAns/peerin/2512.c create mode 100644 OpenJudge/QuestionAns/peerin/2513.c create mode 100644 OpenJudge/QuestionAns/peerin/2514.c create mode 100644 OpenJudge/QuestionAns/peerin/2515.c create mode 100644 OpenJudge/QuestionAns/peerin/2516.c create mode 100644 OpenJudge/QuestionAns/peerin/2517.c create mode 100644 OpenJudge/QuestionAns/peerin/2518.c create mode 100644 OpenJudge/QuestionAns/peerin/2519.c create mode 100644 OpenJudge/QuestionAns/peerin/2520.c create mode 100644 OpenJudge/QuestionAns/peerin/2521.c create mode 100644 OpenJudge/QuestionAns/peerin/2522.c create mode 100644 OpenJudge/QuestionAns/peerin/2523.c create mode 100644 OpenJudge/QuestionAns/peerin/2598.c create mode 100644 OpenJudge/QuestionAns/peerin/2599.c create mode 100644 OpenJudge/QuestionAns/peerin/2600.c create mode 100644 OpenJudge/QuestionAns/peerin/2601.c create mode 100644 OpenJudge/QuestionAns/peerin/2602.c create mode 100644 OpenJudge/QuestionAns/peerin/2606.c create mode 100644 OpenJudge/QuestionAns/peerin/2608.c create mode 100644 OpenJudge/QuestionAns/peerin/2610.c create mode 100644 OpenJudge/QuestionAns/peerin/2611.c create mode 100644 OpenJudge/QuestionAns/peerin/2614.c create mode 100644 OpenJudge/QuestionAns/peerin/2615.c create mode 100644 OpenJudge/QuestionAns/peerin/2616.c create mode 100644 OpenJudge/QuestionAns/peerin/2617.c create mode 100644 OpenJudge/QuestionAns/peerin/2617.cc create mode 100644 OpenJudge/QuestionAns/peerin/2618.c create mode 100644 OpenJudge/QuestionAns/peerin/2619.c create mode 100644 OpenJudge/QuestionAns/peerin/2620.c create mode 100644 OpenJudge/QuestionAns/peerin/2621.c create mode 100644 OpenJudge/QuestionAns/peerin/2622.c create mode 100644 OpenJudge/QuestionAns/peerin/2623.c create mode 100644 OpenJudge/QuestionAns/peerin/2624.c create mode 100644 OpenJudge/QuestionAns/peerin/2625.c create mode 100644 OpenJudge/QuestionAns/peerin/2675.c create mode 100644 OpenJudge/QuestionAns/peerin/2683.c create mode 100644 OpenJudge/QuestionAns/peerin/2684.c create mode 100644 OpenJudge/QuestionAns/peerin/2685.c create mode 100644 OpenJudge/QuestionAns/peerin/2686.c create mode 100644 OpenJudge/QuestionAns/peerin/2687.c create mode 100644 OpenJudge/QuestionAns/peerin/2688.c create mode 100644 OpenJudge/QuestionAns/peerin/2689.c create mode 100644 OpenJudge/QuestionAns/peerin/2690.c create mode 100644 OpenJudge/QuestionAns/peerin/2691.c create mode 100644 OpenJudge/QuestionAns/peerin/2692.c create mode 100644 ProblemSet/1073/input create mode 100644 ProblemSet/1073/output create mode 100644 ProblemSet/1073/problem.md create mode 100644 ProblemSet/1103/input create mode 100644 ProblemSet/1103/output create mode 100644 ProblemSet/1103/problem.md create mode 100644 ProblemSet/1212/input create mode 100644 ProblemSet/1212/output create mode 100644 ProblemSet/1212/problem.md create mode 100644 ProblemSet/1490/input create mode 100644 ProblemSet/1490/output create mode 100644 ProblemSet/1490/problem.md create mode 100644 ProblemSet/1837/input create mode 100644 ProblemSet/1837/output create mode 100644 ProblemSet/1837/problem.md create mode 100644 ProblemSet/1840/input create mode 100644 ProblemSet/1840/output create mode 100644 ProblemSet/1840/problem.md create mode 100644 ProblemSet/1881/input create mode 100644 ProblemSet/1881/output create mode 100644 ProblemSet/1881/problem.md create mode 100644 ProblemSet/2509/input create mode 100644 ProblemSet/2509/output create mode 100644 ProblemSet/2509/problem.md create mode 100644 ProblemSet/2510/input create mode 100644 ProblemSet/2510/output create mode 100644 ProblemSet/2510/problem.md create mode 100644 ProblemSet/2511/input create mode 100644 ProblemSet/2511/output create mode 100644 ProblemSet/2511/problem.md create mode 100644 ProblemSet/2512/input create mode 100644 ProblemSet/2512/output create mode 100644 ProblemSet/2512/problem.md create mode 100644 ProblemSet/2513/input create mode 100644 ProblemSet/2513/output create mode 100644 ProblemSet/2513/problem.md create mode 100644 ProblemSet/2514/input create mode 100644 ProblemSet/2514/output create mode 100644 ProblemSet/2514/problem.md create mode 100644 ProblemSet/2515/input create mode 100644 ProblemSet/2515/output create mode 100644 ProblemSet/2515/problem.md create mode 100644 ProblemSet/2516/input create mode 100644 ProblemSet/2516/output create mode 100644 ProblemSet/2516/problem.md create mode 100644 ProblemSet/2517/input create mode 100644 ProblemSet/2517/output create mode 100644 ProblemSet/2517/problem.md create mode 100644 ProblemSet/2518/input create mode 100644 ProblemSet/2518/output create mode 100644 ProblemSet/2518/problem.md create mode 100644 ProblemSet/2519/input create mode 100644 ProblemSet/2519/output create mode 100644 ProblemSet/2519/problem.md create mode 100644 ProblemSet/2520/input create mode 100644 ProblemSet/2520/output create mode 100644 ProblemSet/2520/problem.md create mode 100644 ProblemSet/2521/input create mode 100644 ProblemSet/2521/output create mode 100644 ProblemSet/2521/problem.md create mode 100644 ProblemSet/2522/input create mode 100644 ProblemSet/2522/output create mode 100644 ProblemSet/2522/problem.md create mode 100644 ProblemSet/2523/input create mode 100644 ProblemSet/2523/output create mode 100644 ProblemSet/2523/problem.md create mode 100644 ProblemSet/2598/input create mode 100644 ProblemSet/2598/output create mode 100644 ProblemSet/2598/problem.md create mode 100644 ProblemSet/2599/input create mode 100644 ProblemSet/2599/output create mode 100644 ProblemSet/2599/problem.md create mode 100644 ProblemSet/2600/input create mode 100644 ProblemSet/2600/output create mode 100644 ProblemSet/2600/problem.md create mode 100644 ProblemSet/2601/input create mode 100644 ProblemSet/2601/output create mode 100644 ProblemSet/2601/problem.md create mode 100644 ProblemSet/2602/input create mode 100644 ProblemSet/2602/output create mode 100644 ProblemSet/2602/problem.md create mode 100644 ProblemSet/2606/input create mode 100644 ProblemSet/2606/output create mode 100644 ProblemSet/2606/problem.md create mode 100644 ProblemSet/2608/input create mode 100644 ProblemSet/2608/output create mode 100644 ProblemSet/2608/problem.md create mode 100644 ProblemSet/2610/input create mode 100644 ProblemSet/2610/output create mode 100644 ProblemSet/2610/problem.md create mode 100644 ProblemSet/2611/input create mode 100644 ProblemSet/2611/output create mode 100644 ProblemSet/2611/problem.md create mode 100644 ProblemSet/2614/input create mode 100644 ProblemSet/2614/output create mode 100644 ProblemSet/2614/problem.md create mode 100644 ProblemSet/2615/input create mode 100644 ProblemSet/2615/output create mode 100644 ProblemSet/2615/problem.md create mode 100644 ProblemSet/2616/input create mode 100644 ProblemSet/2616/output create mode 100644 ProblemSet/2616/problem.md create mode 100644 ProblemSet/2617/input create mode 100644 ProblemSet/2617/output create mode 100644 ProblemSet/2617/problem.md create mode 100644 ProblemSet/2618/input create mode 100644 ProblemSet/2618/output create mode 100644 ProblemSet/2618/problem.md create mode 100644 ProblemSet/2619/input create mode 100644 ProblemSet/2619/output create mode 100644 ProblemSet/2619/problem.md create mode 100644 ProblemSet/2620/input create mode 100644 ProblemSet/2620/output create mode 100644 ProblemSet/2620/problem.md create mode 100644 ProblemSet/2621/input create mode 100644 ProblemSet/2621/output create mode 100644 ProblemSet/2621/problem.md create mode 100644 ProblemSet/2622/input create mode 100644 ProblemSet/2622/output create mode 100644 ProblemSet/2622/problem.md create mode 100644 ProblemSet/2623/input create mode 100644 ProblemSet/2623/output create mode 100644 ProblemSet/2623/problem.md create mode 100644 ProblemSet/2624/input create mode 100644 ProblemSet/2624/output create mode 100644 ProblemSet/2624/problem.md create mode 100644 ProblemSet/2625/input create mode 100644 ProblemSet/2625/output create mode 100644 ProblemSet/2625/problem.md create mode 100644 ProblemSet/2675/input create mode 100644 ProblemSet/2675/output create mode 100644 ProblemSet/2675/problem.md create mode 100644 ProblemSet/2676/input create mode 100644 ProblemSet/2676/output create mode 100644 ProblemSet/2676/problem.md create mode 100644 ProblemSet/2677/input create mode 100644 ProblemSet/2677/output create mode 100644 ProblemSet/2677/problem.md create mode 100644 ProblemSet/2678/input create mode 100644 ProblemSet/2678/output create mode 100644 ProblemSet/2678/problem.md create mode 100644 ProblemSet/2679/input create mode 100644 ProblemSet/2679/output create mode 100644 ProblemSet/2679/problem.md create mode 100644 QuestionAns/peerin/1001.c create mode 100644 QuestionAns/peerin/1002.c create mode 100644 QuestionAns/peerin/1003.c create mode 100644 QuestionAns/peerin/1004.c create mode 100644 QuestionAns/peerin/1005.c create mode 100644 QuestionAns/peerin/1006.c create mode 100644 QuestionAns/peerin/1007.c create mode 100644 QuestionAns/peerin/1008.c create mode 100644 QuestionAns/peerin/1009.c create mode 100644 QuestionAns/peerin/1010.c create mode 100644 QuestionAns/peerin/1012.c create mode 100644 QuestionAns/peerin/1013.c create mode 100644 QuestionAns/peerin/1014.c create mode 100644 QuestionAns/peerin/1015.c create mode 100644 QuestionAns/peerin/1016.c create mode 100644 QuestionAns/peerin/1017.c create mode 100644 QuestionAns/peerin/1018.c create mode 100644 QuestionAns/peerin/1019.c create mode 100644 QuestionAns/peerin/1020.c create mode 100644 QuestionAns/peerin/1021.c create mode 100644 QuestionAns/peerin/1022.c create mode 100644 QuestionAns/peerin/1023.c create mode 100644 QuestionAns/peerin/1024.c create mode 100644 QuestionAns/peerin/1025.c create mode 100644 QuestionAns/peerin/1027.c create mode 100644 QuestionAns/peerin/1028.c create mode 100644 QuestionAns/peerin/1041.c create mode 100644 QuestionAns/peerin/1042.c create mode 100644 QuestionAns/peerin/1043.c create mode 100644 QuestionAns/peerin/1044.c create mode 100644 QuestionAns/peerin/1045.c create mode 100644 QuestionAns/peerin/1046.c create mode 100644 QuestionAns/peerin/1047.c create mode 100644 QuestionAns/peerin/1048.c create mode 100644 QuestionAns/peerin/1049.c create mode 100644 QuestionAns/peerin/1050.c create mode 100644 QuestionAns/peerin/1051.c create mode 100644 QuestionAns/peerin/1052.c create mode 100644 QuestionAns/peerin/1053.c create mode 100644 QuestionAns/peerin/1054.c create mode 100644 QuestionAns/peerin/1055.c create mode 100644 QuestionAns/peerin/1060.c create mode 100644 QuestionAns/peerin/1061.c create mode 100644 QuestionAns/peerin/1062.c create mode 100644 QuestionAns/peerin/1068.c create mode 100644 QuestionAns/peerin/1078.c create mode 100644 QuestionAns/peerin/1079.c create mode 100644 QuestionAns/peerin/1088.c create mode 100644 QuestionAns/peerin/1092.c create mode 100644 QuestionAns/peerin/1093.c create mode 100644 QuestionAns/peerin/1094.c create mode 100644 QuestionAns/peerin/1095.c create mode 100644 QuestionAns/peerin/1097.c create mode 100644 QuestionAns/peerin/1098.c create mode 100644 QuestionAns/peerin/1099.c create mode 100644 QuestionAns/peerin/1100.c create mode 100644 QuestionAns/peerin/1101.c create mode 100644 QuestionAns/peerin/1107.c create mode 100644 QuestionAns/peerin/1133.c create mode 100644 QuestionAns/peerin/1134.c create mode 100644 QuestionAns/peerin/1135.c create mode 100644 QuestionAns/peerin/1136.c create mode 100644 QuestionAns/peerin/1138.c create mode 100644 QuestionAns/peerin/1139.c create mode 100644 QuestionAns/peerin/1140.c create mode 100644 QuestionAns/peerin/1141.c create mode 100644 QuestionAns/peerin/1144.c create mode 100644 QuestionAns/peerin/1145.c create mode 100644 QuestionAns/peerin/1146.c create mode 100644 QuestionAns/peerin/1149.c create mode 100644 QuestionAns/peerin/1153.c create mode 100644 QuestionAns/peerin/1155.c create mode 100644 QuestionAns/peerin/1158.c create mode 100644 QuestionAns/peerin/1162.c create mode 100644 QuestionAns/peerin/1163.c create mode 100644 QuestionAns/peerin/1167.c create mode 100644 QuestionAns/peerin/1168.c create mode 100644 QuestionAns/peerin/1169.c create mode 100644 QuestionAns/peerin/1172.c create mode 100644 QuestionAns/peerin/1176.c create mode 100644 QuestionAns/peerin/1178.c create mode 100644 QuestionAns/peerin/1179.c create mode 100644 QuestionAns/peerin/1180.c create mode 100644 QuestionAns/peerin/1184.c create mode 100644 QuestionAns/peerin/1187.c create mode 100644 QuestionAns/peerin/1189.c create mode 100644 QuestionAns/peerin/1200.c create mode 100644 QuestionAns/peerin/1206.c create mode 100644 QuestionAns/peerin/1207.c create mode 100644 QuestionAns/peerin/1208.c create mode 100644 QuestionAns/peerin/1212.c create mode 100644 QuestionAns/peerin/1213.c create mode 100644 QuestionAns/peerin/1214.c create mode 100644 QuestionAns/peerin/1215.c create mode 100644 QuestionAns/peerin/1216.c create mode 100644 QuestionAns/peerin/1217.c create mode 100644 QuestionAns/peerin/1220.c create mode 100644 QuestionAns/peerin/1221.c create mode 100644 QuestionAns/peerin/1224.c create mode 100644 QuestionAns/peerin/1228.c create mode 100644 QuestionAns/peerin/1233.c create mode 100644 QuestionAns/peerin/1234.c create mode 100644 QuestionAns/peerin/1235.c create mode 100644 QuestionAns/peerin/1236.c create mode 100644 QuestionAns/peerin/1238.c create mode 100644 QuestionAns/peerin/1240.c create mode 100644 QuestionAns/peerin/1241.c create mode 100644 QuestionAns/peerin/1242.c create mode 100644 QuestionAns/peerin/1244.c create mode 100644 QuestionAns/peerin/1245.c create mode 100644 QuestionAns/peerin/1247.c create mode 100644 QuestionAns/peerin/1250.c create mode 100644 QuestionAns/peerin/1251.c create mode 100644 QuestionAns/peerin/1252.c create mode 100644 QuestionAns/peerin/1253.c create mode 100644 QuestionAns/peerin/1254.c create mode 100644 QuestionAns/peerin/1255.c create mode 100644 QuestionAns/peerin/1268.c create mode 100644 QuestionAns/peerin/1271.c create mode 100644 QuestionAns/peerin/1276.c create mode 100644 QuestionAns/peerin/1278.c create mode 100644 QuestionAns/peerin/1286.c create mode 100644 QuestionAns/peerin/1298.c create mode 100644 QuestionAns/peerin/1301.c create mode 100644 QuestionAns/peerin/1334.c create mode 100644 QuestionAns/peerin/1337.c create mode 100644 QuestionAns/peerin/1347.c create mode 100644 QuestionAns/peerin/1368.c create mode 100644 QuestionAns/peerin/1370.c create mode 100644 QuestionAns/peerin/1375.c create mode 100644 QuestionAns/peerin/1376.c create mode 100644 QuestionAns/peerin/1382.c create mode 100644 QuestionAns/peerin/1383.c create mode 100644 QuestionAns/peerin/1384.c create mode 100644 QuestionAns/peerin/1398.c create mode 100644 QuestionAns/peerin/1400.c create mode 100644 QuestionAns/peerin/1403.c create mode 100644 QuestionAns/peerin/1404.c create mode 100644 QuestionAns/peerin/1416.c create mode 100644 QuestionAns/peerin/1417.c create mode 100644 QuestionAns/peerin/1434.c create mode 100644 QuestionAns/peerin/1455.c create mode 100644 QuestionAns/peerin/1457.c create mode 100644 QuestionAns/peerin/1458.c create mode 100644 QuestionAns/peerin/1459.c create mode 100644 QuestionAns/peerin/1460.c create mode 100644 QuestionAns/peerin/1461.c create mode 100644 QuestionAns/peerin/1462.c create mode 100644 QuestionAns/peerin/1463.c create mode 100644 QuestionAns/peerin/1464.c create mode 100644 QuestionAns/peerin/1465.c create mode 100644 QuestionAns/peerin/1466.c create mode 100644 QuestionAns/peerin/1468.c create mode 100644 QuestionAns/peerin/1469.c create mode 100644 QuestionAns/peerin/1473.c create mode 100644 QuestionAns/peerin/1487.c create mode 100644 QuestionAns/peerin/1490.c create mode 100644 QuestionAns/peerin/1494.c create mode 100644 QuestionAns/peerin/1495.c create mode 100644 QuestionAns/peerin/1497.c create mode 100644 QuestionAns/peerin/1503.c create mode 100644 QuestionAns/peerin/1508.c create mode 100644 QuestionAns/peerin/1509.c create mode 100644 QuestionAns/peerin/1511.c create mode 100644 QuestionAns/peerin/1512.c create mode 100644 QuestionAns/peerin/1561.c create mode 100644 QuestionAns/peerin/1586.c create mode 100644 QuestionAns/peerin/1593.c create mode 100644 QuestionAns/peerin/1607.c create mode 100644 QuestionAns/peerin/1611.c create mode 100644 QuestionAns/peerin/1633.c create mode 100644 QuestionAns/peerin/1634.c create mode 100644 QuestionAns/peerin/1637.c create mode 100644 QuestionAns/peerin/1653.c create mode 100644 QuestionAns/peerin/1764.c create mode 100644 QuestionAns/peerin/1766.c create mode 100644 QuestionAns/peerin/1769.c create mode 100644 QuestionAns/peerin/1837.c create mode 100644 QuestionAns/peerin/1840.c create mode 100644 QuestionAns/peerin/1897.c create mode 100644 QuestionAns/peerin/1937.c create mode 100644 QuestionAns/peerin/2025.c create mode 100644 QuestionAns/peerin/2026.c create mode 100644 QuestionAns/peerin/2033.c create mode 100644 QuestionAns/peerin/2036.c create mode 100644 QuestionAns/peerin/2038.c create mode 100644 QuestionAns/peerin/2039.c create mode 100644 QuestionAns/peerin/2040.c create mode 100644 QuestionAns/peerin/2041.c create mode 100644 QuestionAns/peerin/2042.c create mode 100644 QuestionAns/peerin/2043.c create mode 100644 QuestionAns/peerin/2045.c create mode 100644 QuestionAns/peerin/2046.c create mode 100644 QuestionAns/peerin/2293.c create mode 100644 QuestionAns/peerin/2294.c create mode 100644 QuestionAns/peerin/2295.c create mode 100644 QuestionAns/peerin/2296.c create mode 100644 QuestionAns/peerin/2297.c create mode 100644 QuestionAns/peerin/2298.c create mode 100644 QuestionAns/peerin/2300.c create mode 100644 QuestionAns/peerin/2301.c create mode 100644 QuestionAns/peerin/2302.c create mode 100644 QuestionAns/peerin/2413.c create mode 100644 QuestionAns/peerin/2414.c create mode 100644 QuestionAns/peerin/2415.c create mode 100644 QuestionAns/peerin/2421.c create mode 100644 QuestionAns/peerin/2509.cc create mode 100644 QuestionAns/peerin/2598.c create mode 100644 QuestionAns/peerin/2599.c create mode 100644 QuestionAns/peerin/2600.c create mode 100644 QuestionAns/peerin/2601.c create mode 100644 QuestionAns/peerin/2602.c create mode 100644 QuestionAns/peerin/2606.c create mode 100644 QuestionAns/peerin/2608.c create mode 100644 QuestionAns/peerin/2610.c create mode 100644 QuestionAns/peerin/2611.c create mode 100644 QuestionAns/peerin/2614.c create mode 100644 QuestionAns/peerin/2615.c create mode 100644 QuestionAns/peerin/2616.c create mode 100644 QuestionAns/peerin/2617.c create mode 100644 QuestionAns/peerin/2617.cc create mode 100644 QuestionAns/peerin/2618.c create mode 100644 QuestionAns/peerin/2619.c create mode 100644 QuestionAns/peerin/2620.c create mode 100644 QuestionAns/peerin/2621.c create mode 100644 QuestionAns/peerin/2622.c create mode 100644 QuestionAns/peerin/2623.c create mode 100644 QuestionAns/peerin/2624.c create mode 100644 QuestionAns/peerin/2625.c create mode 100644 QuestionAns/peerin/2675.c diff --git a/OpenJudge/ProblemSet/1510/input b/OpenJudge/ProblemSet/1510/input new file mode 100644 index 0000000..b9bf7fb --- /dev/null +++ b/OpenJudge/ProblemSet/1510/input @@ -0,0 +1,4 @@ +6 5 +8 3 +1 5 +2 3 diff --git a/OpenJudge/ProblemSet/1510/output b/OpenJudge/ProblemSet/1510/output new file mode 100644 index 0000000..c43498e --- /dev/null +++ b/OpenJudge/ProblemSet/1510/output @@ -0,0 +1,4 @@ +1 +7 +1 +2 diff --git a/OpenJudge/ProblemSet/1510/problem.md b/OpenJudge/ProblemSet/1510/problem.md new file mode 100644 index 0000000..d087aa7 --- /dev/null +++ b/OpenJudge/ProblemSet/1510/problem.md @@ -0,0 +1,37 @@ +# 猴子选大王 +Time Limit: 2 Sec  Memory Limit: 16 MB + + +## Description +有一群进化程度很高的猴子,它们不再通过群殴产生猴王,而是采用一种非常文明的方法选出新的猴王。 +假设猴群里有m只猴子,它们在篝火旁围坐成一个圈:某只猴子是1号,沿顺时针方向是2号、3号……m号,然后回到1号。由上一代猴王说出一个数字n,从1号猴子开始报数,报到n的猴子出局;再从刚出局猴子的下一个位置开始报数,报到n的猴子出局……如此重复,直至剩下一只猴子,它就成为新的猴王。 +例如,当m=6、n=5时,依次出局的猴子序号是5、4、6、2、3,最后剩下1号是新猴王。 +你来编写一个程序,模拟这个过程,算出第几号猴子会成为新的猴王。 + + +## Input +输入最多不超过100行,至EOF结束。每行一组数据,每组数据包含两个整数m和n(0> a >> b >> c; + f(a, b, c); + return 0; +} + +``` diff --git a/OpenJudge/ProblemSet/2687/input b/OpenJudge/ProblemSet/2687/input new file mode 100644 index 0000000..ee7b32e --- /dev/null +++ b/OpenJudge/ProblemSet/2687/input @@ -0,0 +1,2 @@ +5 +1 2 3 4 5 diff --git a/OpenJudge/ProblemSet/2687/output b/OpenJudge/ProblemSet/2687/output new file mode 100644 index 0000000..d945d07 --- /dev/null +++ b/OpenJudge/ProblemSet/2687/output @@ -0,0 +1 @@ +1 5 \ No newline at end of file diff --git a/OpenJudge/ProblemSet/2687/problem.md b/OpenJudge/ProblemSet/2687/problem.md new file mode 100644 index 0000000..5aba686 --- /dev/null +++ b/OpenJudge/ProblemSet/2687/problem.md @@ -0,0 +1,59 @@ +# 求数组中最大最小值(Append Code) +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +         给出若干整数,求其中的最大值和最小值。 + + +## Input +         首先输入一个整数n(n<100),然后输入n个整数。 + + +## Output +         输出n个整数中的最小值和最大值。 + + +## Sample Input +``` +5 +1 2 3 4 5 + +``` +## Sample Output +``` +1 5 +``` + +## HINT + + +## Append Code +### append.c +```c +int main() +{ + int max, min, ar[100], i, n; + scanf("%d", &n); + for(i = 0; i < n; i++) + scanf("%d", &ar[i]); + max_min(&max, &min, ar, n); + printf("%d %d\n", min, max); + return 0; +} + +``` +### append.cc +```cpp +int main() +{ + int max, min, ar[100], i, n; + scanf("%d", &n); + for(i = 0; i < n; i++) + scanf("%d", &ar[i]); + max_min(&max, &min, ar, n); + printf("%d %d\n", min, max); + return 0; +} + +``` diff --git a/OpenJudge/ProblemSet/2688/input b/OpenJudge/ProblemSet/2688/input new file mode 100644 index 0000000..35d8db8 --- /dev/null +++ b/OpenJudge/ProblemSet/2688/input @@ -0,0 +1,2 @@ +20011101 +20220909 diff --git a/OpenJudge/ProblemSet/2688/output b/OpenJudge/ProblemSet/2688/output new file mode 100644 index 0000000..b5c86ae --- /dev/null +++ b/OpenJudge/ProblemSet/2688/output @@ -0,0 +1,2 @@ +2001 11 1 +2022 9 9 diff --git a/OpenJudge/ProblemSet/2688/problem.md b/OpenJudge/ProblemSet/2688/problem.md new file mode 100644 index 0000000..f28514b --- /dev/null +++ b/OpenJudge/ProblemSet/2688/problem.md @@ -0,0 +1,68 @@ +# 字符串转日期(Append Code) +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +         对于用字符串存储的日期,把它的年月日提取出来转换成结构体形式。 +----------------------------------------------------------------------------- +         编写函数 to_date (): +                   原型:根据“Append Code”进行设计。 +                   功能:把字符串s中年月日信息提取出来,并用结构体变量返回。 +         函数的调用格式见“Append Code”,完成结构体类型的定义。 + + +## Input +         输入若干字符串,每个一行。每个字符串为一个合法的日期,其中前4位表示年份,中间两位表示月份,后2位表示日,位数不足会补0。 + + +## Output +         按照年月日的顺序输出,两两用一个空格分开。 + + +## Sample Input +``` +20011101 +20220909 + +``` +## Sample Output +``` +2001 11 1 +2022 9 9 + +``` + +## HINT + + +## Append Code +### append.c +```c +int main() +{ + char str[10]; + struct date dt; + while(gets(str) != NULL) + { + dt = to_date(str); + printf("%d %d %d\n", dt.y, dt.m, dt.d); + } + return 0; +} + +``` +### append.cc +```cpp +int main() +{ + char str[10]; + struct date dt; + while(gets(str) != NULL) + { + dt = to_date(str); + printf("%d %d %d\n", dt.y, dt.m, dt.d); + } + return 0; +} + +``` diff --git a/OpenJudge/ProblemSet/2689/input b/OpenJudge/ProblemSet/2689/input new file mode 100644 index 0000000..7813681 --- /dev/null +++ b/OpenJudge/ProblemSet/2689/input @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/OpenJudge/ProblemSet/2689/output b/OpenJudge/ProblemSet/2689/output new file mode 100644 index 0000000..301160a --- /dev/null +++ b/OpenJudge/ProblemSet/2689/output @@ -0,0 +1 @@ +8 \ No newline at end of file diff --git a/OpenJudge/ProblemSet/2689/problem.md b/OpenJudge/ProblemSet/2689/problem.md new file mode 100644 index 0000000..2625d25 --- /dev/null +++ b/OpenJudge/ProblemSet/2689/problem.md @@ -0,0 +1,30 @@ +# 递归求斐波那契数 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +         斐波那契数列是1、2、3、5、8、13……。其中,每项是前两项之和。 +         现在请你用递归方法编程求斐波纳契数列第n项。 +         ----------------------------------------------------------------------------- +         Invalid Word(禁用单词)错误:在解决这个题目时,某些关键词是不允许被使用的。如果提交的程序中包含了下列的关键词之一,就会产生这个错误。 +         被禁用的关键字:for, while, do, break, continue, goto。 + + +## Input +         输入一个整数n。 + + +## Output +         输出斐波那契数列的第n项。 + + +## Sample Input +``` +5 +``` +## Sample Output +``` +8 +``` + +## HINT diff --git a/OpenJudge/ProblemSet/2690/input b/OpenJudge/ProblemSet/2690/input new file mode 100644 index 0000000..032b158 --- /dev/null +++ b/OpenJudge/ProblemSet/2690/input @@ -0,0 +1,6 @@ +7 +21 +49 +58 +73 +101 diff --git a/OpenJudge/ProblemSet/2690/output b/OpenJudge/ProblemSet/2690/output new file mode 100644 index 0000000..994f234 --- /dev/null +++ b/OpenJudge/ProblemSet/2690/output @@ -0,0 +1,6 @@ +NO +NO +NO +YES +NO +YES diff --git a/OpenJudge/ProblemSet/2690/problem.md b/OpenJudge/ProblemSet/2690/problem.md new file mode 100644 index 0000000..4589d07 --- /dev/null +++ b/OpenJudge/ProblemSet/2690/problem.md @@ -0,0 +1,38 @@ +# 与7无关的数 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +         一个整数如果每位数字不是7,同时既不是7的倍数,也不是7的平方、立方、四次方……。那么这个整数是与7无关的数 + + +## Input +         输入若干int范围内的整数,至EOF结束。 + + +## Output +         若是与7无关的数输出YES,否则输出NO。 + + +## Sample Input +``` +7 +21 +49 +58 +73 +101 + +``` +## Sample Output +``` +NO +NO +NO +YES +NO +YES + +``` + +## HINT diff --git a/OpenJudge/ProblemSet/2691/input b/OpenJudge/ProblemSet/2691/input new file mode 100644 index 0000000..0f88f03 --- /dev/null +++ b/OpenJudge/ProblemSet/2691/input @@ -0,0 +1,3 @@ +11 +FF +379A diff --git a/OpenJudge/ProblemSet/2691/output b/OpenJudge/ProblemSet/2691/output new file mode 100644 index 0000000..eacbba7 --- /dev/null +++ b/OpenJudge/ProblemSet/2691/output @@ -0,0 +1,3 @@ +17 +255 +14234 diff --git a/OpenJudge/ProblemSet/2691/problem.md b/OpenJudge/ProblemSet/2691/problem.md new file mode 100644 index 0000000..d4deda8 --- /dev/null +++ b/OpenJudge/ProblemSet/2691/problem.md @@ -0,0 +1,33 @@ +# 十六进制转十进制 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +         十六进制是计算机中数据的一种表示方法,与十进制的对应关系是:十六进制的0~9对应十进制数值0-9,A~F对应十进制数值10-15。 +         现在你编写一个程序,完成一个十六进制数到十进制表示的转换。 + + +## Input +         输入为多行,至EOF结束。每行为一个十六进制无符号整数n,n不超过int范围。n只包括数字0~9和大写字母A~F。 + + +## Output +         输出有多行,每一行输出与输入相对应,是n的十进制。 + + +## Sample Input +``` +11 +FF +379A + +``` +## Sample Output +``` +17 +255 +14234 + +``` + +## HINT diff --git a/OpenJudge/ProblemSet/2692/input b/OpenJudge/ProblemSet/2692/input new file mode 100644 index 0000000..7813681 --- /dev/null +++ b/OpenJudge/ProblemSet/2692/input @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/OpenJudge/ProblemSet/2692/output b/OpenJudge/ProblemSet/2692/output new file mode 100644 index 0000000..dfeef5c --- /dev/null +++ b/OpenJudge/ProblemSet/2692/output @@ -0,0 +1,5 @@ +21 +23 +25 +27 +29 diff --git a/OpenJudge/ProblemSet/2692/problem.md b/OpenJudge/ProblemSet/2692/problem.md new file mode 100644 index 0000000..c767172 --- /dev/null +++ b/OpenJudge/ProblemSet/2692/problem.md @@ -0,0 +1,36 @@ +# 尼科梅彻斯定理 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +         任何一个正整数n的立方都可以唯一地写成n个相邻奇数之和。这就是尼科梅彻斯定理。例如, +         13 = 1 +         23 = 8 = 3 + 5 +         33 = 27 = 7 + 9 + 11 +         43 = 64 = 13 + 15 + 17 + 19 +现在你编程序计算n3是哪些相邻奇数之和。 + + +## Input +         输入一个正整数n,且n<1291。 + + +## Output +         输出为n个相邻整数,它们的和为n3。 + + +## Sample Input +``` +5 +``` +## Sample Output +``` +21 +23 +25 +27 +29 + +``` + +## HINT diff --git a/OpenJudge/ProblemSet/2693/input b/OpenJudge/ProblemSet/2693/input new file mode 100644 index 0000000..21b4a03 --- /dev/null +++ b/OpenJudge/ProblemSet/2693/input @@ -0,0 +1,4 @@ +2019-07-18 +2022-01-01 +2011-12-30 +2033-11-30 diff --git a/OpenJudge/ProblemSet/2693/output b/OpenJudge/ProblemSet/2693/output new file mode 100644 index 0000000..8a69cb1 --- /dev/null +++ b/OpenJudge/ProblemSet/2693/output @@ -0,0 +1,4 @@ +2019-07-19 +2022-01-02 +2011-12-31 +2033-12-01 diff --git a/OpenJudge/ProblemSet/2693/problem.md b/OpenJudge/ProblemSet/2693/problem.md new file mode 100644 index 0000000..c51133a --- /dev/null +++ b/OpenJudge/ProblemSet/2693/problem.md @@ -0,0 +1,34 @@ +# 求下一天 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +         给出一个日期,输出下一天的日期。 + + +## Input +         输入若干日期至EOF结束,格式为y-m-d,其中y、m、d是三个正整数表示年月日,均为合法日期,其中y的输入范围是1000~9999年。 + + +## Output +         输出每个日期下一天的日期。 + + +## Sample Input +``` +2019-07-18 +2022-01-01 +2011-12-30 +2033-11-30 + +``` +## Sample Output +``` +2019-07-19 +2022-01-02 +2011-12-31 +2033-12-01 + +``` + +## HINT diff --git a/OpenJudge/ProblemSet/2694/input b/OpenJudge/ProblemSet/2694/input new file mode 100644 index 0000000..a92f28a --- /dev/null +++ b/OpenJudge/ProblemSet/2694/input @@ -0,0 +1,22 @@ +15 +to +too +two +teem +tool +taste +tooth +be +bee +bed +box +bend +book +below +bench +t 1 +e 2 +o 3 +h -1 +e -2 +b -3 diff --git a/OpenJudge/ProblemSet/2694/output b/OpenJudge/ProblemSet/2694/output new file mode 100644 index 0000000..7d6c19f --- /dev/null +++ b/OpenJudge/ProblemSet/2694/output @@ -0,0 +1,6 @@ +to too two teem tool taste tooth +teem be bee bed bend below bench +too two tool tooth book +tooth bench +teem bee bed +bee bed box diff --git a/OpenJudge/ProblemSet/2694/problem.md b/OpenJudge/ProblemSet/2694/problem.md new file mode 100644 index 0000000..c5ce278 --- /dev/null +++ b/OpenJudge/ProblemSet/2694/problem.md @@ -0,0 +1,55 @@ +# 查找单词 +Time Limit: 1 Sec  Memory Limit: 128 MB + + +## Description +          给出n个英文单词,查找出其中正数或倒数第p个字符是c有哪些。 + + +## Input +          输入分为两部分。 +         第一部分首先是一个整数n(n<=500),后接n个长度小于30的英文单词,这些单词均为小写字母组成。 +         第二部分是不超过100行,每行是一次查找,至EOF结束。每次查找的输入为一个英文字母c和一个整数p,用一个分隔开。若p为正,则在n个单词中查找左起第p个字符为c的所有单词;若p为负,则在n个单词中查找右起第p个字符为c的所有单词。 + +## Output +          输出为每次查找单词的结果,与输入的第二部分对应。每次查找的结果输出一行,若有多个单词符合查找条件,按照输入的顺序依次输出,两两单词间用一个空格分隔。若没有找到符合条件的单词,那么输出一个空行。 + + +## Sample Input +``` +15 +to +too +two +teem +tool +taste +tooth +be +bee +bed +box +bend +book +below +bench +t 1 +e 2 +o 3 +h -1 +e -2 +b -3 + +``` +## Sample Output +``` +to too two teem tool taste tooth +teem be bee bed bend below bench +too two tool tooth book +tooth bench +teem bee bed +bee bed box + +``` + +## HINT diff --git a/OpenJudge/QuestionAns/peerin/1001.c b/OpenJudge/QuestionAns/peerin/1001.c new file mode 100644 index 0000000..a134196 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1001.c @@ -0,0 +1,15 @@ +#include + +int main(){ +printf("Hello Da_min,\nHello Er_min,\nHello Xiao_ming!\n"); +return 0; +} +/************************************************************** + Problem: 1001 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:744 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1002.c b/OpenJudge/QuestionAns/peerin/1002.c new file mode 100644 index 0000000..aa753b6 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1002.c @@ -0,0 +1,18 @@ +#include + +int main(){ +int x,y; +scanf("x = %d, y = %d",&x,&y); +printf("x + y : %d\nx - y : %d\nx * y : %d\nx / y quotient: %d, remainder: %d\nx ^ 2 : %d\ny ^ 3 : %d",x+y,x-y,x*y,x/y,x%y,x*x,y*y*y); +return 0; +} + +/************************************************************** + Problem: 1002 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1003.c b/OpenJudge/QuestionAns/peerin/1003.c new file mode 100644 index 0000000..dd0f092 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1003.c @@ -0,0 +1,18 @@ +#include +#define PI 3.14 + +int main(){ +double r; +scanf("%lf",&r); +printf("Area: %f\nPerimeter: %f",PI*r*r,2*PI*r); +return 0; +} +/************************************************************** + Problem: 1003 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1004.c b/OpenJudge/QuestionAns/peerin/1004.c new file mode 100644 index 0000000..17aeee1 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1004.c @@ -0,0 +1,18 @@ +#include + +int main(){ +int x,y,z; +scanf("%d %d %d",&x,&y,&z); +printf("%.3f",(x+y+z)/3.0); +return 0; +} + +/************************************************************** + Problem: 1004 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1005.c b/OpenJudge/QuestionAns/peerin/1005.c new file mode 100644 index 0000000..9eaffaf --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1005.c @@ -0,0 +1,19 @@ +#include + +int main(){ + double meiyuan,ouyuan,riyuan; + int waibi,rmb; + scanf("%lf %lf %lf\n%d\n%d",&meiyuan,&ouyuan,&riyuan,&waibi,&rmb); + printf("%.2f %.2f %.2f\n%.2f %.2f %.2f",meiyuan/100*waibi,ouyuan/100*waibi,riyuan/100*waibi,rmb/(meiyuan/100),rmb/(ouyuan/100),rmb/(riyuan/100)); +return 0; +} + +/************************************************************** + Problem: 1005 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1006.c b/OpenJudge/QuestionAns/peerin/1006.c new file mode 100644 index 0000000..cd63a99 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1006.c @@ -0,0 +1,20 @@ +#include + +int main(){ + char a,b,c; + scanf("%c%c%c",&a,&b,&c); + printf("%03d %03o %03x\n",a,a,a); + printf("%03d %03o %03x\n",b,b,b); + printf("%03d %03o %03x\n",c,c,c); + return 0; +} + +/************************************************************** + Problem: 1006 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1007.c b/OpenJudge/QuestionAns/peerin/1007.c new file mode 100644 index 0000000..f587547 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1007.c @@ -0,0 +1,19 @@ +#include + +int main(){ + int num; + scanf("%d",&num); + printf("%s",num%2==0 ? "even" : "odd"); + + return 0; +} + +/************************************************************** + Problem: 1007 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1008.c b/OpenJudge/QuestionAns/peerin/1008.c new file mode 100644 index 0000000..ce724e5 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1008.c @@ -0,0 +1,23 @@ +#include + +int main(){ + int int1; + double double1; + scanf("%d",&int1); + scanf("%lf",&double1); + printf("%d\n",int1<0?-int1:int1); + printf("%g\n",double1<0?-double1:double1); + + + return 0; +} + +/************************************************************** + Problem: 1008 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1009.c b/OpenJudge/QuestionAns/peerin/1009.c new file mode 100644 index 0000000..aac857b --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1009.c @@ -0,0 +1,21 @@ +#include + +int main(){ + int m,n,x; + scanf("%d %d %d",&m,&n,&x); + int sum = m*x; + double total = sum >= n ? sum*0.88 : sum; + printf("%.2f",total); + return 0; + +} + +/************************************************************** + Problem: 1009 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1010.c b/OpenJudge/QuestionAns/peerin/1010.c new file mode 100644 index 0000000..6130fee --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1010.c @@ -0,0 +1,18 @@ +#include + +int main(){ + int n; + scanf("%d",&n); + printf("%s",n%4==0&&n%100!=0||n%400==0?"Yes":"No"); + return 0; +} + +/************************************************************** + Problem: 1010 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1012.c b/OpenJudge/QuestionAns/peerin/1012.c new file mode 100644 index 0000000..db9b368 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1012.c @@ -0,0 +1,34 @@ +#include +int is_(int num){ + int is_or_not; + int hundred,ten,several; + hundred = num/100; + ten = (num-hundred*100)/10; + several = num - hundred*100 - ten*10; + if(hundred*hundred*hundred+ten*ten*ten+several*several*several==num) + is_or_not = 1; + else + is_or_not = 0; + + + return is_or_not; +} +int main(){ + int num; + scanf("%d",&num); + printf("%s",is_(num)?"YES":"NO"); + + + + return 0; +} + +/************************************************************** + Problem: 1012 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1013.c b/OpenJudge/QuestionAns/peerin/1013.c new file mode 100644 index 0000000..0ccbee9 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1013.c @@ -0,0 +1,36 @@ +#include +int find_max(int change,int face){ + int max=-1; + int temp; + do{ + max++; +temp = change - max*face; + + }while(temp>=face); + return max; +} + +int main(){ + int x; + scanf("%d",&x); + int change = 100 - x; + int d20 = find_max(change,20); + int d10 = find_max(change-20*d20,10); + int d5 = find_max(change-20*d20-10*d10,5); + int d1 = find_max(change-20*d20-10*d10-5*d5,1); + printf("$20 bills: %d\n",d20); + printf("$10 bills: %d\n",d10); + printf(" $5 bills: %d\n",d5); + printf(" $1 bills: %d",d1); + return 0; +} + +/************************************************************** + Problem: 1013 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1014.c b/OpenJudge/QuestionAns/peerin/1014.c new file mode 100644 index 0000000..5ae8ac5 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1014.c @@ -0,0 +1,36 @@ +#include + +int main(){ + char a[50],b[50]; + int i2 = 0; + int zero_flag = 0; + scanf("%s",a); + for(int i = 0;i < 50;i++){ + if(a[i]=='0'&&zero_flag==0){ + zero_flag = 1; + ; + }else if(a[i]=='\0'){ + b[i2] = a[i]; + break; + } + else if(a[i]=='('||a[i]==')'||a[i]=='-'){ + ; + } + else{ + b[i2] = a[i]; + i2++; + } + } + printf("0086%s",b); + return 0; +} + +/************************************************************** + Problem: 1014 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1015.c b/OpenJudge/QuestionAns/peerin/1015.c new file mode 100644 index 0000000..644b4cd --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1015.c @@ -0,0 +1,38 @@ +#include +int main(){ +long long x; +scanf("%lld",&x); +unsigned long long y = (1.0+x)*x/2.0; +printf("%llu",y); +return 0; +} + + + + + + + + + + + + + + + + + + + + + +/************************************************************** + Problem: 1015 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1016.c b/OpenJudge/QuestionAns/peerin/1016.c new file mode 100644 index 0000000..020cac9 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1016.c @@ -0,0 +1,20 @@ +#include +#include + +int main() +{ +double n; +scanf("%lf",&n); + + printf("%d",(int)log2(n)); + return 0; +} +/************************************************************** + Problem: 1016 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:756 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1017.c b/OpenJudge/QuestionAns/peerin/1017.c new file mode 100644 index 0000000..7f82595 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1017.c @@ -0,0 +1,42 @@ +#include +#include +int main(){ +char *s1,*s2; +s1 = (char *)malloc(sizeof(char)*27); +s2 = (char *)malloc(sizeof(char)*27); +//scanf("%s",s1); +//scanf("%s",s2); +gets(s1); +gets(s2); +int len1,len2; +for(int i = 0;i < 27;++i){ +if(s1[i] == '\0'){ +len1 = i+1; +break; +} +} +for(int i = 0;i < 27;++i){ +if(s2[i] == '\0'){ +len2 = i+1; +break; +} +} +if(len1<=len2){ +printf("%s\n%s",s2,s1); +}else{ + +printf("%s\n%s",s1,s2); +} +free(s1); +free(s2); +return 0; +} +/************************************************************** + Problem: 1017 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1018.c b/OpenJudge/QuestionAns/peerin/1018.c new file mode 100644 index 0000000..d356ee5 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1018.c @@ -0,0 +1,31 @@ +#include + + +int main(){ + int a[3]; + for(int i = 0;i < 3;i++){ + scanf("%d",&a[i]); + } + for(int i = 0;i < 3;i++){ + for(int j = i;j < 3;j++){ + if(a[j] +int find_number(int m,int n){ + int MAX = 10000; + int temp; + for(int i = 1;i temp) + break; + if(temp == n*j) + return temp; + + } + } +} + +int main(){ + int k,m,n; + int res[101]; + int count = 0; + scanf("%d%d%d",&k,&m,&n); + int m_n = m%n==0 ? m : n%m==0 ? n : find_number(m,n); + // printf("%d\n",m_n); + for(int i = 1;i<=k;++i){ + if((i%m==0||i%n==0)&&(i%m_n!=0)){ + res[count] = i; + count++; + } + } + for(int i = 0;i < count;++i){ + printf("%d",res[i]); + if(i != count-1) + printf(" "); + + + } + + return 0; +} + +/************************************************************** + Problem: 1019 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1020.c b/OpenJudge/QuestionAns/peerin/1020.c new file mode 100644 index 0000000..5b7e597 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1020.c @@ -0,0 +1,24 @@ +#include + +int main(){ + int a[100],b[100]; + int i = 0; + for(;i < 100;i++){ + if(scanf("%d %d",a + i,b + i) == EOF) + break; + } + for(int i2 = 0;i2 < i;i2++){ + printf("%d\n",*(a+i2)+*(b+i2)); + } + return 0; +} + +/************************************************************** + Problem: 1020 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1021.c b/OpenJudge/QuestionAns/peerin/1021.c new file mode 100644 index 0000000..527b362 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1021.c @@ -0,0 +1,25 @@ +#include + +int main(){ + int N; + scanf("%d",&N); + int a[N],b[N]; + for(int i =0 ;i + +int main(){ + int a[100],b[100]; + int i = 0; + for(;i < 100;i++){ + scanf("%d %d",a + i,b + i); + if(a[i] == 0 && b[i] == 0) + break; + } + for(int i2 = 0;i2 < i;i2++){ + printf("%d\n",*(a+i2)+*(b+i2)); + } + return 0; +} + +/************************************************************** + Problem: 1022 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1023.c b/OpenJudge/QuestionAns/peerin/1023.c new file mode 100644 index 0000000..c0993d0 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1023.c @@ -0,0 +1,24 @@ +#include + +int main(){ + int a[100],b[100]; + int i = 0; + for(;i < 100;i++){ + if(scanf("%d %d",a + i,b + i) == EOF) + break; + } + for(int i2 = 0;i2 < i;i2++){ + printf("%d\n\n",*(a+i2)+*(b+i2)); + } + return 0; +} + +/************************************************************** + Problem: 1023 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1024.c b/OpenJudge/QuestionAns/peerin/1024.c new file mode 100644 index 0000000..cd53b9a --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1024.c @@ -0,0 +1,33 @@ +#include + +int main(){ + int n; + scanf("%d",&n); + int number[n]; + + for(int i = 0;i < n;++i){ + scanf("%d",&number[i]); + } + int max = number[0]; + int min = number[0]; + + for(int i = 0;i < n;++i){ + if(number[i]>=max) + max = number[i]; + if(number[i]<=min) + min = number[i]; + + } + printf("The maximum number is %d.\nThe minimum number is %d.",max,min); + return 0; +} + +/************************************************************** + Problem: 1024 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1025.c b/OpenJudge/QuestionAns/peerin/1025.c new file mode 100644 index 0000000..ecb71c0 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1025.c @@ -0,0 +1,68 @@ +#include +void func(int score){ + + if(score < 0||score>100) + printf("Error\n"); + else{ + score = score / 10; + switch(score){ + case 0: + printf("Failing\n"); + break; + case 1: + printf("Failing\n"); + break; + case 2: + printf("Failing\n"); + break; + case 3: + printf("Failing\n"); + break; + case 4: + printf("Failing\n"); + break; + case 5: + printf("Failing\n"); + break; + case 6: + printf("Pass\n"); + break; + case 7: + printf("Average\n"); + break; + case 8: + printf("Good\n"); + break; + case 9: + printf("Excellent\n"); + break; + case 10: + printf("Excellent\n"); + break; + default: + printf("Error\n"); + } + + } + +} +int main(){ + int score; + while( scanf("%d",&score)!=EOF){ + func(score); + } + + + + return 0; +} + +/************************************************************** + Problem: 1025 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1027.c b/OpenJudge/QuestionAns/peerin/1027.c new file mode 100644 index 0000000..231c1f8 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1027.c @@ -0,0 +1,37 @@ +#include +int judge(int m){ + if(m == 0)return 0; + for(int i = 2;i +#include +#include +void c_f(){ + int low,high; + double step; + scanf("%d",&low); + scanf("%d",&high); + scanf("%lf",&step); + if(low>high){ + int temp = high; + high = low; + low = temp; + } + + printf("%4c -> %4c\n",'C','F'); + for(double i = low;i %5.1f\n",i,i/(5.0/9.0)+32); + } +} +void f_c(){ + int low,high; + double step; + scanf("%d",&low); + scanf("%d",&high); + scanf("%lf",&step); + if(low>high){ + int temp = high; + high = low; + low = temp; + } + printf("%4c -> %4c\n",'F','C'); + for(double i = low;i %5.1f\n",i,(i-32)*(5.0/9.0)); + } +} +int main(){ + char a,b; + scanf("%c->%c",&a,&b); + if(a=='F'&&b=='C'){ + f_c(); + }else if(a=='C'&&b=='F'){ + c_f(); + } + return 0; +} + +/************************************************************** + Problem: 1028 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1041.c b/OpenJudge/QuestionAns/peerin/1041.c new file mode 100644 index 0000000..5d9b6f7 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1041.c @@ -0,0 +1,84 @@ +#include + +int abs(int a){ + + return a<=0?-a:a; + + } +int min(int a,int b){ + + return ab?a:b; + + +} +/* int gcd(int a,int b){ */ + +/* if(a==0) */ +/* return b; */ +/* else if(b == 0) */ +/* return a; */ +/* else { */ +/* return gcd(min(a,b),abs(a-b)); */ +/* } */ +/* } */ +int gcd(int a, int b){ + int tmpp = a; + tmpp= max(a,b); + b = min(a,b); + a = tmpp; + int temp = 2147483647; + loop: + for(;temp>=b;){ + temp = a % b; + if(temp==0) + return b; +} + int tmp = b; + b = temp; + a = tmp; + temp = 2147483647; + goto loop; + +} + +int lcm(int a,int b){ + + + return a/gcd(a,b)*b; + +} + +int main(){ + int a, b; + // printf("%d",gcd(1,1)); + while(scanf("%d %d",&a,&b)!=EOF){ + if(a == 0 && b == 0){ + printf("%d %d\n",0,0); + } + else if(a == 0){ + printf("%d %d\n",b,0); + }else if(b==0){ + printf("%d %d\n",a,0); + } + else + printf("%d %d\n",gcd(a,b),lcm(a,b)); + } + + + return 0; +} + +/************************************************************** + Problem: 1041 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1042.c b/OpenJudge/QuestionAns/peerin/1042.c new file mode 100644 index 0000000..4952f3c --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1042.c @@ -0,0 +1,25 @@ +#include +int main(){ + int sum=0; + int a; + int N; + while(scanf("%d",&N)!=EOF){ + sum = 0; + for(int i = 0;i +int main(){ + int sum=0; + int a; + int M,N; + scanf("%d",&M); + for(int i = 0;i < M;++i){ + sum = 0; + scanf("%d",&N); + for(int j = 0;j +int main(){ + int sum=0; + int a; + int N=0; + while(scanf("%d",&N)&&N!=0){ + sum = 0; + for(int i = 0;i +int main(){ + int sum=0; + int a; + int M,N; + scanf("%d",&M); + for(int i = 0;i < M;++i){ + sum = 0; + scanf("%d",&N); + for(int j = 0;j + +int main() +{ + int a_cock_money, b_hen_money, c_chick_num, d_chick_money, m_money, n_num, x_cock, y_hen, z_chick, f=0; + scanf("COCK,HEN,CHICK,MONEY,CHICKS"); + while(scanf("%d,%d,%d/%d,%d,%d",&a_cock_money,&b_hen_money,&c_chick_num,&d_chick_money,&m_money,&n_num) != EOF) + { + f=0; + + for(x_cock=0;x_cock<=m_money/a_cock_money;x_cock++) + { + + y_hen=(m_money*d_chick_money-c_chick_num*n_num+x_cock*(c_chick_num-a_cock_money*d_chick_money))/(b_hen_money*d_chick_money-c_chick_num); + z_chick=n_num-x_cock-y_hen; + if(x_cock>=0&&y_hen>=0&&z_chick>=0&&a_cock_money*d_chick_money*x_cock+b_hen_money*d_chick_money*y_hen+c_chick_num*z_chick==d_chick_money*m_money) + { + if(f==0) + printf("COCKS,HENS,CHICKS\n"); + f=1; + printf("%d,%d,%d\n", x_cock, y_hen, z_chick); + } + } + if(f==0) + printf("Cannot buy!\n"); + printf("\n"); + + } + return 0; +} + +/************************************************************** + Problem: 1046 + User: 202211070518 + Language: C + Result: Accepted + Time:12 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1047.c b/OpenJudge/QuestionAns/peerin/1047.c new file mode 100644 index 0000000..12f420c --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1047.c @@ -0,0 +1,27 @@ +#include +/* unsigned long long shengun(unsigned long long n){ */ +/* return (n-1llu)*1000llu+471llu; */ +/* } */ +int main(){ + + unsigned long long n; + while(scanf("%llu",&n)!=EOF){ +if(n==1) +printf("471\n"); +else + printf("%llu471\n",n-1); + + + } + +} + +/************************************************************** + Problem: 1047 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1048.c b/OpenJudge/QuestionAns/peerin/1048.c new file mode 100644 index 0000000..ce5b5b6 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1048.c @@ -0,0 +1,58 @@ +#include + + +int main() +{ + int n,i,j,a,b,num,u,v; + int c[100][100]; + while(scanf("%d",&n)!=EOF) + { + num=n*n; + for(i=0; i +int array[1000000]={0}; +int max_term(int i,int j){ + int max = array[i]; + for(int index = i;index<=j;++index){ + if(array[index]>max){ + max = array[index]; + } + } + return max; +} + +int func(int input_beg, int input_end){ + static int caculated = 1; + if(input_end<=caculated){ + return max_term(input_beg,input_end); + }else{ + for(int i = caculated;i<=input_end;++i){ + int count = 0; + unsigned int n = i; + start:count++; + if(n == 1){ + goto end; + } + else{ + if(n%2!=0){ + n = n*3 + 1; + goto start; + } + else{ + n = n/2; + goto start; + } + + } + + end:array[i]=count; + + } + caculated = input_end; + return max_term(input_beg,input_end); + } + +} + +int max(int i,int j){ + return i>j?i:j; +} +int min(int i,int j){ + return i +#include +#include +#include +#include + +int main() +{ + int n, m; + int i, j; + int sta[2][1005]; + int f; + + while (1) { + if (scanf("%d", &n)==EOF) + break; + else { + memset(sta, 0, sizeof sta); + for (i=0; in?m:n); i++) { + if (f) { + printf("%d", sta[0][i]+sta[1][i]); + f=0; + } else { + printf(" %d", sta[0][i]+sta[1][i]); + } + } + putchar('\n'); + } + + + + + return 0; +} + +/************************************************************** + Problem: 1050 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1051.c b/OpenJudge/QuestionAns/peerin/1051.c new file mode 100644 index 0000000..4ffb96b --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1051.c @@ -0,0 +1,48 @@ +#include + +int main() +{ + int ar[1000] = { 0 }; + int n, i, a, j = 0, h, m=0,b=1,c; + scanf("%d",&n); + while (b<=n) { + b++; + c=0; + while(scanf("%d", &a)&&a!=0){ + ar[c] += a; + c++; + } + if (c > m) + m = c; + j++; + if (j == 2) { + for (i = 0; i < m; i++) + if (i == 0) + printf("%d", ar[i]); + else + printf(" %d", ar[i]); + printf("\n"); + j = 0; + m = 0; + for (h = 0; h < 1000; h++) + ar[h] = 0; + } + } + if (j == 1) { + for (i = 0; i < c; i++) + if (i == 0) + printf("%d", ar[i]); + else + printf(" %d", ar[i]); + printf("\n"); + } +} +/************************************************************** + Problem: 1051 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1052.c b/OpenJudge/QuestionAns/peerin/1052.c new file mode 100644 index 0000000..b69cde3 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1052.c @@ -0,0 +1,97 @@ +#include +#include +int main() { + int q,i,t,m,n,x; + int a[1001]= {0}; + int b[1001]= {0}; + scanf("%d",&n); + for(q=1; q<=n; q++) { + if(q%2!=0) //奇数赋值给A + { + scanf("%d",&t); + for(i=0; im?t:m;//直接比较两个数组的长度 用if(t>m)讨论的话会多一倍的代码 比较麻烦 + if(x==0) //长度为0的情况 + { + printf("\n"); + } + else + { + for(i=0; im?t:m; + if(x==0) + { + printf("\n"); + } else { + for(i=0; i +#include +#define MAX_LINE 100 +#define MAX_COLUMN 100 +int mN[MAX_LINE][MAX_COLUMN]; + +int getMatrix(int m[][MAX_COLUMN], int l, int c) { + for (int i = 0; i < l; ++i) { + for (int j = 0; j < c; ++j) { + scanf("%d", &m[i][j]); + } + } + return 0; +} + +int revMatrix(int m[][MAX_COLUMN], int l, int c) { + + for (int i = 0; i < c; ++i) { + for (int j = 0; j < l; ++j) { + mN[i][j] = m[j][i]; + } + } + + return 0; +} + +int putMatrix(int l, int c) { + for (int i = 0; i < l; ++i) { + for (int j = 0; j < c; ++j) { + if (j == 0) + printf("%d", mN[i][j]); + else + printf(" %d", mN[i][j]); + } + printf("\n"); + } + return 0; +} + +int main(int argc, char* argv[]) { + + int n; + scanf("%d", &n); + for (int i = 0; i < n; ++i) { + int l, c; + scanf("%d%d", &l, &c); + int m[MAX_LINE][MAX_COLUMN]; + getMatrix(m, l, c); + revMatrix(m, l, c); + putMatrix( c, l); + if (i != n - 1) + printf("\n"); + } + + return 0; +} + +/************************************************************** + Problem: 1053 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:784 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1054.c b/OpenJudge/QuestionAns/peerin/1054.c new file mode 100644 index 0000000..b6cd864 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1054.c @@ -0,0 +1,49 @@ +#include +#include +#include +int main() +{ + int arr1[105][105],arr2[105][105]; + int x,y; + while(scanf("%d%d",&x,&y)!=EOF&&x!=0&&y!=0) + { + int i,j,m, n; + for(i=0; i +#include +#include +void input(int input[102][102],int m,int n) +{ + int i,j; + for(i=0;i +#include +int chuli(char input[]){ + int index = 0,flag = 0; + int len = strlen(input); + //printf("%d\n",len); + for(int i = 0;is2_len){ + return 1; + } + else if(s1_len == s2_len){ + if(s1[0]>s2[0]){ + return 1; + + } + else if(s1[0]==s2[0]){ + if(s1[0]=='\0'&&s2[0]=='\0'){ + return 0; + }else{ + return biggerp(s1+1,s2+1); + } + } + else{ + return 0; + } + + } + else{ + return 0; + } +} + +int equalp(char s1[],char s2[]){ + return strcmp(s1,s2)==0?1:0; +} + +int lessp(char s1[],char s2[]){ + + return !(biggerp(s1,s2)||equalp(s1,s2))?1:0; + + +} +char max[1001] = {0}; +char min[1001] = {0}; + +int main(){ + char input[1001]={0}; + int flag = 0; + while(scanf("%s",input)!=EOF){ + chuli(input); + if(flag == 0){ + strcpy(max,input); + strcpy(min,input); + flag = 1; + } + + //printf("chuli done\n"); + if(biggerp(input,max)){ + memcpy(max,input,1001); + } + //printf("biggerp done\n"); + if(lessp(input,min)){ + + memcpy(min,input,1001); + } + memset(input,'\0',1001); + //printf("lessp done\n"); + } + printf("The maximum value is : %s\nThe minimum value is : %s",max,min); + return 0; +} + +/************************************************************** + Problem: 1060 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1061.c b/OpenJudge/QuestionAns/peerin/1061.c new file mode 100644 index 0000000..ce39d94 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1061.c @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#define MAX_STR_LEN 101 + +int main() +{ + char a[1009]; + char b[1009]; + char c[1009]; + while(gets(a)!=NULL) + { + int l=strlen(a); + int i,j,k,m=0; + for(i=0;i='A' && a[i]<='Z') + { + b[m]=a[i]; + ++m; + } + if(a[i]>='a' && a[i]<='z') + { + b[m]=a[i]-'a'+'A'; + ++m; + } + if(a[i]>='0' && a[i]<='9') + { + b[m]=a[i]; + ++m; + } + } + b[m]=0; + // printf("%s\n",b); + l=strlen(b); + int x=0; + for(i=l-1;i>=0;--i) + { + char temp=b[i]; + c[x]=temp; + ++x; + } + + c[x]=0; + //printf("%s",c); + if(strcmp(b,c)==0) printf("Yes.\n"); + else printf("No.\n"); + } + return 0; +} + + +/************************************************************** + Problem: 1061 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1062.c b/OpenJudge/QuestionAns/peerin/1062.c new file mode 100644 index 0000000..3e63249 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1062.c @@ -0,0 +1,72 @@ +#include +#include +#include +#include +#define MAX_STR_LEN 101 + +int main() +{ + int n,x,y; + scanf("%d",&n); + int i=0; +//freopen("123.txt","w",stdout); + char a[10009]; + char b[10009]; + for(i=0;i='a' && a[k]<='z') a[k]=a[k]-'a'+'A'; + } + for(k=0; k='A' && a[k]<='Z') + { + if(y>0) + { + a[k]=a[k]+y; + if(a[k]>'Z') a[k]=a[k]-26; + b[m]=a[k]; + ++m; + } + else + { + a[k]=a[k]+y; + if(a[k]<'A') a[k]=a[k]+26; + b[m]=a[k]; + ++m; + } + } + } + b[m]=0; + int ll=strlen(b); + + printf("%d %s\n",ll,b); + + } + //if(i +#include +#include +#include +#include +#define SWAP(a,b,t) t=a; a=b; b=t; +#define MAX 12 +char t[12][10] = {"14041","03030","13121","13131","04130","12131","12141","13030","14141","14131"}; +void Print(char ch,int n) +{ + while(n--) putchar(ch); +} +void PrintRow(char s[],int i,int n) +{ + int k; + for(k=0; s[k]; ++k) + { + if(k) putchar(' '); + switch(t[s[k]-'0'][i]) + { + case '0': + Print(' ',n+2); + break; + case '1': + putchar(' '); + Print('-',n); + putchar(' '); + break; + case '2': + putchar('|'); + Print(' ',n+1); + break; + case '3': + Print(' ',n+1); + putchar('|'); + break; + case '4': + putchar('|'); + Print(' ',n); + putchar('|'); + break; + } + } + putchar('\n'); +} +void Solve(char s[],int n) +{ + int i,j,k; + PrintRow(s,0,n); + for(j=0; j +#include +#include +#include +int main() +{ + int m,n; + //freopen("123.txt","r",stdin); + scanf("%d%d",&m,&n); + getchar(); + char name[109][30]; + int a[109][27]={0}; + int b[109]; + int i,j; + for( i=0;imax) max=l; + } + for( i=0; i=b[i]) + { + if(flag==0) printf("%s",name[k]); + else printf(",%s",name[k]); + flag=1; + flag2=1; + break; + } + } + } + + if(flag2==0) printf("NONE!"); + printf("\n"); + } +} +/************************************************************** + Problem: 1078 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1079.c b/OpenJudge/QuestionAns/peerin/1079.c new file mode 100644 index 0000000..473c4ac --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1079.c @@ -0,0 +1,23 @@ +#include +int main(){ + int n,a,b,c; + scanf("%d",&n); + for(int i = 0;i< n;++i){ + scanf("%d %d %d",&a,&b,&c); + printf("%s",a+b>c&&a+c>b&&b+c>a?"YES\n":"NO\n"); + + } + + + return 0; +} + +/************************************************************** + Problem: 1079 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1088.c b/OpenJudge/QuestionAns/peerin/1088.c new file mode 100644 index 0000000..0d837a5 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1088.c @@ -0,0 +1,25 @@ +#include +#include +#include +int main(){ +int n; +scanf("%d",&n); +n = abs(n); +if(n<100){ + printf("%d",n); +} +else{ + printf("%02d",n%100); +} +return 0; +} + +/************************************************************** + Problem: 1088 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1092.c b/OpenJudge/QuestionAns/peerin/1092.c new file mode 100644 index 0000000..de2506c --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1092.c @@ -0,0 +1,26 @@ +#include +#include + +int main(){ + +char s[101]; +scanf("%s",s); +int len = strlen(s); +int i; +for(i = len-1;i>=0;--i) + printf("%c",s[i]); + + + +return 0; +} + +/************************************************************** + Problem: 1092 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1093.c b/OpenJudge/QuestionAns/peerin/1093.c new file mode 100644 index 0000000..b2bd283 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1093.c @@ -0,0 +1,39 @@ +#include +#include + +int main(){ + + char passwd[20] = {0}; + scanf("%s",passwd); + char input[20] = {0}; + int count = 0; + while(scanf("%s",input)!=EOF){ + count++; + if(strcmp(input,passwd)==0&&count<=5){ + printf("Welcome!\n"); + } + else if(count>5){ + printf("Out of limited!\n"); + } + else{ + + printf("Wrong!\n"); + } + + + } + + + + return 0; +} + +/************************************************************** + Problem: 1093 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1094.c b/OpenJudge/QuestionAns/peerin/1094.c new file mode 100644 index 0000000..84cd259 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1094.c @@ -0,0 +1,61 @@ +#include +#include +#include + +int getchar_no_space(char input[]){ + char result[101]={0}; + int index = 0; + int input_len = strlen(input); + for(int i = 0;i=0;--i){ + if(!isspace(input[i])){ + end = i; + break; + } + } + input[end+1]='\0'; + char input2[101]={0}; + memcpy(input2,input,101); + getchar_no_space(input2); + if(strcmp(input2,"END")==0){ + printf("%s",input2); + break; + }else{ + printf("%s\n",input+beg); + } + gets(input); + } + return 0; +} + +/************************************************************** + Problem: 1094 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1095.c b/OpenJudge/QuestionAns/peerin/1095.c new file mode 100644 index 0000000..a6a1019 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1095.c @@ -0,0 +1,34 @@ +#include +int fib[50]; +// 2 * 1024 * 1024/4 +int fib_f(int n){ + + fib[0] = 1; + fib[1] = 2; + for(int i = 2;i +/* +若输入的三条边构成等边三角形,输出“a equileteral triangle”; + +若输入的三条边构成等腰三角形,输出“a isosceles triangle”; + +若输入的三条边构成直角三角形,输出“a right triangle”; + +若输入的三条边构成三角形,但不是以上三种,则输出“a triangle”; + +若输入的三条边不构成,输出“not a triangle”。 + */ +int main(){ + + int a,b,c; + while(scanf("%d%d%d",&a,&b,&c)!=EOF){ + if(a==0&&b==0&&c==0) + break; + printf("%s",a+b>c&&a+c>b&&b+c>a&&a-b + + +int main(){ + + int num; + while(scanf("%d",&num)!=EOF&&num!=0){ + + printf("%d%s\n",num,num%10==1?"st":num%10==2?"nd":num%10==3?"rd":"th"); + + + } + + +} + +/************************************************************** + Problem: 1098 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1099.c b/OpenJudge/QuestionAns/peerin/1099.c new file mode 100644 index 0000000..c4e28e0 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1099.c @@ -0,0 +1,45 @@ + #include +#include +int cmpfunc (const void * a, const void * b) +{ + return ( *(int*)a - *(int*)b ); +} + +int main(){ + + int n; + scanf("%d",&n); + if(n<=0)return 1; + int list[n]; + for(int i=0;i*(list+j+1)){ */ +/* int temp = *(list+j); */ +/* *(list+j)=*(list+j+1); */ +/* *(list+j+1)=temp; */ +/* } */ +/* } */ +/* } */ + qsort(list,n,4,cmpfunc); + for(int i = 0;i + + +int main(){ + int n; + scanf("%d",&n); + printf("Sun Mon Tue Wen Thu Fri Sat\n"); + if(n!=7){ + + for(int i = 0;i<(n*4);++i){ + printf(" "); + + + } + } + int n1 = 7-n; + for(int i = 1;i<=30;++i){ + if(i==n1||(i-n1)%7==0){ + printf("%3d\n",i); + + } + else if(i == 30){ + + printf("%3d",i); + } + else{ + + printf("%3d ",i); +} +} + + return 0; +} + +/************************************************************** + Problem: 1100 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1101.c b/OpenJudge/QuestionAns/peerin/1101.c new file mode 100644 index 0000000..2f7d110 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1101.c @@ -0,0 +1,31 @@ +#include +int main(){ + + int n; + scanf("%d",&n); + for(int i = 0;i12||month<1||day<1||day>31){printf("error date!\n");continue;} + if((!is_leap)&&month==2&&(day>28)||is_leap&&month==2&&(day>29)||(!(month==1||month==3||month==5||month==7||month==8||month==10||month==12))&&(day>30)){printf("error date!\n");continue;} + + int sum_day = 0; + for(int i = 1;i +#define SWAP(t,x,y) t=x;x=y;y=t + +int int_swap(int *x1,int *y1){ + int tmp = *x1; + *x1 = *y1; + *y1 = tmp; + return 0; +} + +int dbl_swap(double *x1,double *y1){ + double tmp = *x1; + *x1 = *y1; + *y1 = tmp; + return 0; +} + + + + + + +int main() +{ + int x1, y1, t1; + double x2, y2, t2; + + scanf("%d %d", &x1, &y1); + int_swap(&x1, &y1); + printf("%d %d\n", x1, y1); + + scanf("%d %d", &x1, &y1); + SWAP(t1, x1, y1); + printf("%d %d\n", x1, y1); + + scanf("%lf %lf", &x2, &y2); + dbl_swap(&x2, &y2); + printf("%lg %lg\n", x2, y2); + + scanf("%lf %lf", &x2, &y2); + SWAP(t2, x2, y2); + printf("%lg %lg\n", x2, y2); +} + +/************************************************************** + Problem: 1107 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1133.c b/OpenJudge/QuestionAns/peerin/1133.c new file mode 100644 index 0000000..bff01a0 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1133.c @@ -0,0 +1,50 @@ +#include +#include +#include +#define MAX_STR_LEN 11 + +int strToInt(char s[]){ + if(strlen(s) == 0) return -1; + if(!(s[0] >= '0' && s[0] <= '9')) return 0; + int beg = 0; + int i; + for(i = 0;s[i] != '\0';++i){ + if(s[i] >= '0' && s[i] <= '9'){ + beg = i; + break; + } + } + int res = 0; + int count = 0; + for(i = beg;s[i] >= '0' && s[i] <= '9' && s[i] != '\0';++i){ + if(s[i] == '0' && i == beg){ + beg++; + continue; + } + count++; + } + // printf("count:%d\nbeg:%d\n",count,beg); + for(i = beg;(i - beg) < count;++i){ + res += pow(10,count - (i - beg) - 1) * (s[i] - '0'); + } + return res; +} + + +int main() +{ + char s[MAX_STR_LEN]; + while(gets(s) != NULL) + printf("%d\n", strToInt(s)); + return 0; +} + +/************************************************************** + Problem: 1133 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:760 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1134.c b/OpenJudge/QuestionAns/peerin/1134.c new file mode 100644 index 0000000..3cac568 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1134.c @@ -0,0 +1,63 @@ +#include +#include +#include +#define MAX_STR_LEN 12 + +int strToInt(char s[]){ + int negFlag = 0; + int len = strlen(s); + if(len == 0) return 0; + int i; + for(i = 0;i < len;++i){ + if(i == 0){ + if(!(s[i] >= '0' && s[i] <= '9')){ + if(s[i] == '+') negFlag = 0; + else if(s[i] == '-') negFlag = 1; + else return 0; + } + } + else{ + if(!(s[i] >= '0' && s[i] <= '9')) return 0; + else break; + } + } + int beg = 0; + for(i = 0;s[i] != '\0';++i){ + if(s[i] >= '0' && s[i] <= '9'){ + beg = i; + break; + } + } + int res = 0; + int count = 0; + for(i = beg;s[i] >= '0' && s[i] <= '9' && s[i] != '\0';++i){ + if(s[i] == '0' && i == beg){ + beg++; + continue; + } + count++; + } + // printf("count:%d\nbeg:%d\n",count,beg); + for(i = beg;(i - beg) < count;++i){ + res += pow(10,count - (i - beg) - 1) * (s[i] - '0'); + } + return negFlag == 1?-res:res; +} + + +int main() +{ + char s[MAX_STR_LEN]; + while(gets(s) != NULL) + printf("%d\n", strToInt(s)); + return 0; +} +/************************************************************** + Problem: 1134 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:760 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1135.c b/OpenJudge/QuestionAns/peerin/1135.c new file mode 100644 index 0000000..db60153 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1135.c @@ -0,0 +1,83 @@ +#include +#include +#include +#define MAX_STR_LEN 11 + +int extractStr(char t[],char s[],int len){ + int i; + int idx = 0; + for(i = 0;i < len;++i){ + if(s[i] >= '0' && s[i] <= '9'){ + t[idx++] = s[i]; + } + else if(i == 0){ + if(s[i] == '-') + t[idx++] = '-'; + } + } + t[idx] = '\0'; + return 0; +} + +int strToInt(char s[]){ + int negFlag = 0; + int len = strlen(s); + char strExtracted[MAX_STR_LEN] = {0}; + extractStr(strExtracted,s,len); + len = strlen(strExtracted); + memcpy(s,strExtracted,MAX_STR_LEN); + if(len == 0) return 0; + int i; + for(i = 0;i < len;++i){ + if(i == 0){ + if(!(s[i] >= '0' && s[i] <= '9')){ + if(s[i] == '+') negFlag = 0; + else if(s[i] == '-') negFlag = 1; + else return 0; + } + } + else{ + if(!(s[i] >= '0' && s[i] <= '9')) return 0; + else break; + } + } + int beg = 0; + for(i = 0;s[i] != '\0';++i){ + if(s[i] >= '0' && s[i] <= '9'){ + beg = i; + break; + } + } + int res = 0; + int count = 0; + for(i = beg;s[i] >= '0' && s[i] <= '9' && s[i] != '\0';++i){ + if(s[i] == '0' && i == beg){ + beg++; + continue; + } + count++; + } + // printf("count:%d\nbeg:%d\n",count,beg); + for(i = beg;(i - beg) < count;++i){ + res += pow(10,count - (i - beg) - 1) * (s[i] - '0'); + } + return negFlag == 1?-res:res; +} + + +int main() +{ + char s[MAX_STR_LEN]; + while(gets(s) != NULL) + printf("%d\n", strToInt(s)); + return 0; +} +/************************************************************** + Problem: 1135 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:760 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1136.c b/OpenJudge/QuestionAns/peerin/1136.c new file mode 100644 index 0000000..a4676e5 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1136.c @@ -0,0 +1,177 @@ +#include +#include +#include +#include +#define MAX_STR_LEN 101 +#define POSITIVE 1 +#define NEGATIVE 0 + +int strToUpper(char s[]){ + + int i; + for(i = 0;s[i] != '\0';++i){ + s[i] = toupper(s[i]); + } + return i; +} + +int ishex(int c){ + + if((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')) + return 1; + else + return 0; + +} + +int isbin(int c){ + + if(c >= '0' && c <= '1') + return 1; + else + return 0; + +} + +int isoct(int c){ + + if(c >= '0' && c <= '7') + return 1; + else + return 0; + +} + +int isdec(int c){ + if(c >= '0' && c <= '9') + return 1; + else + return 0; +} + +int (*(retOp(int base)))(int){ + switch(base){ + case 2: + return isbin; + break; + case 8: + return isoct; + break; + case 10: + return isdec; + break; + case 16: + return ishex; + break; + default: + return NULL; + } +} + +void conv(char s[],int len){ + + int i; + for(i = 0;i < len;++i){ + switch(s[i]){ + case '1': + s[i] = 1; + break; + case '2': + s[i] = 2; + break; + case '3': + s[i] = 3; + break; + case '4': + s[i] = 4; + break; + case '5': + s[i] = 5; + break; + case '6': + s[i] = 6; + break; + case '7': + s[i] = 7; + break; + case '8': + s[i] = 8; + break; + case '9': + s[i] = 9; + break; + case '0': + s[i] = 0; + break; + case 'A': + s[i] = 10; + break; + case 'B': + s[i] = 11; + break; + case 'C': + s[i] = 12; + break; + case 'D': + s[i] = 13; + break; + case 'E': + s[i] = 14; + break; + case 'F': + s[i] = 15; + break; + default: + ; + } + } +} + +int strToIntCustome(char s[],int (*op)(int),int base){ + int i,count = 0,res = 0; + char ch; + char s2[MAX_STR_LEN] = {0}; + for(i = 0;(ch = s[i]) != '\0';++i){ + if(op(ch)){ + s2[count++] = ch; + } + } + conv(s2,count); + for(i = 0;i < count;++i){ + res += pow(base,count - i - 1) * s2[i]; + } + return res; +} + +int strToInt(char s[],int base){ + int len = strToUpper(s),symFlag = POSITIVE; + int i; + char s2[MAX_STR_LEN] = {0}; + if(s[0] == '-') symFlag = NEGATIVE; + if(s[0] == '+') symFlag = POSITIVE; + if(s[0] == '-' || s[0] == '+') memcpy(s2,s + 1,MAX_STR_LEN - 1); + else memcpy(s2,s,MAX_STR_LEN); + int (*op)(int) = retOp(base); + int res = strToIntCustome(s2,op,base); + return symFlag == POSITIVE ? res : -res; +} + + +int main() +{ + int base; + char s[MAX_STR_LEN]; + while( (scanf("%d:", &base) != EOF) && (gets(s) != NULL) ) + printf("%d\n", strToInt(s, base)); + return 0; +} + +/************************************************************** + Problem: 1136 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:760 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1138.c b/OpenJudge/QuestionAns/peerin/1138.c new file mode 100644 index 0000000..824345b --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1138.c @@ -0,0 +1,28 @@ +#include +#define MAX_STR_LEN 100 + +int str_cmp(char s1[],char s2[]){ + for(int i = 0;s1[i]!='\0';++i){ + int d = s1[i]-s2[i]; + if(d!=0)return d; +} + return 0; +} + + +int main() +{ + char str1[MAX_STR_LEN], str2[MAX_STR_LEN]; + while( (gets(str1) != NULL) && (gets(str2) != NULL) ) + printf("%d\n", str_cmp(str1, str2)); + return 0; +} +/************************************************************** + Problem: 1138 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1139.c b/OpenJudge/QuestionAns/peerin/1139.c new file mode 100644 index 0000000..709c184 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1139.c @@ -0,0 +1,35 @@ +#include +#define MAX_STR_LEN 101 + +char ch_abs(char num){ + return num>0?num:-num; +} + +int str_cmp(char s1[],char s2[]){ + int idx = 0; + while(1){ + char d = s1[idx]-s2[idx]; + if(!(ch_abs(d)=='a'-'A'||d==0))return d; + if(s1[idx]=='\0'&&s2[idx]=='\0') return 0; + idx++; + } +} + + + +int main() +{ + char str1[MAX_STR_LEN], str2[MAX_STR_LEN]; + while( (gets(str1) != NULL) && (gets(str2) != NULL) ) + printf("%d\n", str_cmp(str1, str2)); + return 0; +} +/************************************************************** + Problem: 1139 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1140.c b/OpenJudge/QuestionAns/peerin/1140.c new file mode 100644 index 0000000..4ce68cc --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1140.c @@ -0,0 +1,78 @@ +#include +#define MAX_SIZE 1000 +#define OVER -1 +#define EXIST -2 + +int globalLen; + +int getarray(int a[]){ + int currentNum; + int i=0; + while(1){ + scanf("%d",¤tNum); + if(currentNum==0) break; + a[i++]=currentNum; + } + globalLen = i; + return i; +} + +int insert(int a[],int key, int vol){ + if(globalLen > vol){ + return OVER; + } + int i,eqFlag = 0; + for(i = 0;i < globalLen;++i){ + if(a[i] == key){ + eqFlag = 1; + } + } + if(eqFlag == 1){ + return EXIST; + } + int res = 0; + for(i = 0;i < globalLen;++i){ + if(key > a[i]){ + res = i + 1; + } + } + return res; +} + +int result(int sig){ + switch(sig){ + case OVER: + printf("The array if full!\n"); + break; + case EXIST: + printf("The key is already in this array!\n"); + break; + default: + printf("The key is inserted in position %d.\n",sig); + break; + } + return 0; +} + + +int main() +{ + int array[MAX_SIZE], cases, i, key; + scanf("%d", &cases); + for(i = 1; i <= cases; i++) + { + getarray(array); + scanf("%d", &key); + result(insert(array, key, MAX_SIZE - 1)); + } + return 0; +} +/************************************************************** + Problem: 1140 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1141.c b/OpenJudge/QuestionAns/peerin/1141.c new file mode 100644 index 0000000..c6ec0f6 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1141.c @@ -0,0 +1,105 @@ +#include +#include +#define MAX_SIZE 1000 +#define OVER -1 +#define EXIST -2 + +int globalLen; + +int getarray(int a[]){ + int currentNum; + int i=0; + while(1){ + scanf("%d",¤tNum); + if(currentNum==0) break; + a[i++]=currentNum; + } + globalLen = i; + return i; +} + +int insert(int a[],int key, int vol){ + if(globalLen > vol){ + return OVER; + } + int i,eqFlag = 0; + for(i = 0;i < globalLen;++i){ + if(a[i] == key){ + eqFlag = 1; + } + } + if(eqFlag == 1){ + return EXIST; + } + int res = 0; + for(i = 0;i < globalLen;++i){ + if(key > a[i]){ + res = i + 1; + } + } + int tmp[MAX_SIZE]={0}; + int idx = 0; + for(i = 0;i < globalLen + 1;++i){ + if(i == res){ + tmp[i] = key; + } + else{ + tmp[i] = a[idx++]; + } +} + memcpy(a,tmp,MAX_SIZE); + globalLen++; + return res; +} + +int result(int sig){ + switch(sig){ + case OVER: + printf("The array if full!\n"); + break; + case EXIST: + printf("The key is already in this array!\n"); + break; + default: + printf("The key is inserted in position %d.\n",sig); + break; + } + return 0; +} + +int getkey(int k[]){ + + int size; + scanf("%d",&size); + int i; + for(i = 0;i < size;++i){ + scanf("%d",k + i); + } + return size; +} + + +int main() +{ + int array[MAX_SIZE], cases, ca, i, key[MAX_SIZE], size; + scanf("%d", &cases); + for(ca = 1; ca <= cases; ca++) + { + getarray(array); + size = getkey(key); + printf("Case %d:\n", ca); + for(i = 0; i < size; i++) + result(insert(array, key[i], MAX_SIZE - 1)); + } + return 0; +} + +/************************************************************** + Problem: 1141 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1144.c b/OpenJudge/QuestionAns/peerin/1144.c new file mode 100644 index 0000000..223cdf6 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1144.c @@ -0,0 +1,63 @@ +#include +#define MAX_SIZE 1000 + +int get_array(int a[]){ + int n; + scanf("%d",&n); + for(int i = 0;imax)max = a[i]; + } + return max; +} + +int max_index(int idx[],int a[],int n){ + int max = max_value(a,n); + int count=0; + for(int i =0;i + +int main(){ + int N; + scanf("%d",&N); + int i; + for(i = 1;i<=N;++i){ + + int max,min; + scanf("%d%d",&min,&max); + int sum = 0; + int j; + for(j = min;j<=max;++j){ + sum += j; + } + printf("case %d:sum=%d.\n",i,sum); + + } + return 0; +} + +/************************************************************** + Problem: 1145 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1146.c b/OpenJudge/QuestionAns/peerin/1146.c new file mode 100644 index 0000000..24923f9 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1146.c @@ -0,0 +1,58 @@ +#include +#include +double func(double x){ + + if(x<0){ + + return -x; + + } + else if(x>=0&&x<1){ + return sin(2 * x); + + } + else if(x>=1&&x<5){ + + + return sqrt(x*x*x+x); + + } + else{ + return 2*x+10; + } + + + +} + + + +int output(int n,double x){ + + printf("case %d:y=%.6g.\n",n,x); + return 1; + +} + + +int main() +{ + int i, cases; + double x; + scanf("%d", &cases); + for(i = 1; i <= cases; i++) + { + scanf("%lf", &x); + output(i, func(x)); + } + return 0; +} +/************************************************************** + Problem: 1146 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:756 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1149.c b/OpenJudge/QuestionAns/peerin/1149.c new file mode 100644 index 0000000..73fa5e9 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1149.c @@ -0,0 +1,30 @@ +#include +#include + + +int main(){ + + int n; + scanf("%d",&n); + int i; + getchar(); + for(i = 0;i +#define MAX_SIZE 1000 + +int get_array(int a[]){ + + int size; + scanf("%d",&size); + for(int i = 0;i +#define MAX_SIZE 1000 + +int get_array(int a[],int n){ + int i; +for(i = 0;i +int main(){ +int a,b; +scanf("%d%d",&a,&b); +printf("Octal Decimal Hexadecimal\n"); +printf("%-6o%-8d%x\n%-6o%-8d%x",a,a,a,b,b,b); +return 0; +} + +/************************************************************** + Problem: 1158 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1162.c b/OpenJudge/QuestionAns/peerin/1162.c new file mode 100644 index 0000000..9bd474a --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1162.c @@ -0,0 +1,42 @@ +#include + +int main(){ + double x,y; + scanf("(%lf, %lf)",&x,&y); + if(x==0){ + if(y==0){ + printf("(0.0, 0.0) is origin"); + }else + printf("(%.1f, %.1f) is on the y axis",x,y); +} + else if(y == 0){ + printf("(%.1f, %.1f) is on the x axis",x,y); + } + else if(x<0){ + if(y>0){ + printf("(%.1f, %.1f) is in quadrand II",x,y); +} + else if(y<0){ + printf("(%.1f, %.1f) is in quadrand III",x,y); + } + } + else if(x>0){ + if(y>0){ + printf("(%.1f, %.1f) is in quadrand I",x,y); +} + else if(y<0){ + printf("(%.1f, %.1f) is in quadrand IV",x,y); + } + } + return 0; +} + +/************************************************************** + Problem: 1162 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1163.c b/OpenJudge/QuestionAns/peerin/1163.c new file mode 100644 index 0000000..c19b46b --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1163.c @@ -0,0 +1,46 @@ +#include + +int trans(int hour24){ + + + + if(hour24==0)return 12; + if(hour24>0&&hour24<=12)return hour24; + if(hour24>12&&hour24<24)return hour24-12; + + + +} + +int ap(int hour24){ + + if(hour24==0)return 1; + if(hour24>0&&hour24<12)return 1; + if(hour24>=12&&hour24<24)return 0; + + + +} + + +int main(){ + + int hour24,minute24; + scanf("%d:%d",&hour24,&minute24); + int hour12,minute12; + minute12 = minute24; + hour12 = trans(hour24); + printf("%02d:%02d %s\n",hour12,minute12,ap(hour24)?"a.m.":"p.m."); + + return 0; +} + +/************************************************************** + Problem: 1163 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1167.c b/OpenJudge/QuestionAns/peerin/1167.c new file mode 100644 index 0000000..d6ea5b0 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1167.c @@ -0,0 +1,43 @@ +#include + +int main(){ + + int n; + scanf("%d",&n); + if(n==0){ + printf("0"); + + } + else if(n>0){ + int i; + for( i = 1;i<= n;++i){ + printf("%d",i); + if(i!=n) printf(" "); + + + + } + + } + else if(n<0){ + + int i; + for( i = n;i<=-1;++i){ + + printf("%d",i); + if(i!=-1) printf(" "); + + } + + } +} + +/************************************************************** + Problem: 1167 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1168.c b/OpenJudge/QuestionAns/peerin/1168.c new file mode 100644 index 0000000..2cc5420 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1168.c @@ -0,0 +1,43 @@ +#include + +int main(){ + + long long n; + scanf("%lld",&n); + long long i; + for(i = 0;i < n;++i){ + long long p,q; + scanf("%lld%lld",&p,&q); + + long long j; + long long temp = p; +if(p>=q){ + p = q; + q = temp; + } +for(j = p;j<=q;++j){ + printf("%lld",j); + if(j!=q)printf(" "); + } + + + + if(i!=n-1)printf("\n\n"); + else ; + + + + } + + +} + +/************************************************************** + Problem: 1168 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1169.c b/OpenJudge/QuestionAns/peerin/1169.c new file mode 100644 index 0000000..a3520af --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1169.c @@ -0,0 +1,55 @@ +#include +#include +#include +#define IN_WORD 0 +#define OUT_OF_WORD 1 + +int analyse(char s[]){ + int len = strlen(s); + int result = 0; + int status = OUT_OF_WORD; + for(int i = 0;i +#include + +int rev(char s[]){ + int len = 100; + char s1[100]={0}; + int numcount = 0; + for(int i = 0;i < len;++i){ + if(s[i]!=0)numcount++; + } + + for(int i = 0;i + +int main(){ + + int m; + scanf("%d",&m); + for(int i = 0;i + +int main(){ + + int array[101]={0}; + int score; + while(scanf("%d",&score)!=EOF){ + if(score>=0&&score<=100) + array[score]++; + + } + int max = 0; + for(int i = 0;i<=100;++i){ + + if(array[i]>max){ + + max = array[i]; + + } + + } + + for(int i = 0;i<=100;++i){ + + if(array[i]==max){ + printf("%d\n",i); + } + + } + + return 0; +} + +/************************************************************** + Problem: 1178 + User: 202211070518 + Language: C + Result: Accepted + Time:16 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1179.c b/OpenJudge/QuestionAns/peerin/1179.c new file mode 100644 index 0000000..c15120c --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1179.c @@ -0,0 +1,76 @@ +#include +#include +#include +/* void filter(int* list,int start){ */ +/* int newlist[50000]={0}; */ +/* if(list[start]==0) ; */ +/* else{ */ +/* for(int i = 0;i<=start;++i){ */ +/* newlist[i]=list[i]; */ +/* } */ +/* int count = start+1; */ +/* for(int i = start;list[i]!=0;++i){ */ +/* if(list[i]%list[start]!=0){ */ +/* newlist[count++]=list[i]; */ +/* } */ +/* } */ +/* for(int i = 0;i<50000;++i){ */ +/* list[i] = newlist[i]; */ +/* } */ +/* // printf("%d\n",start); */ +/* filter(list,++start); */ +/* } */ +/* } */ + +int main(){ + int start = 0; + int* list = calloc(500001,sizeof(int)); + for(int i = 2;i<=500001;++i){ + list[i-2]=i; + } + // filter(list,0); + while(start<=708){ //啊哈哈啊哈哈哈哈哈哈,终于被我发现了 只要到根号下500000就好了 不用循环500000次 妈的! + int* newlist = calloc(500001,sizeof(int)); + //printf("%d\n",start); + for(int i = 0;i<=start;++i){ + newlist[i]=list[i]; + } + int count = start+1; + for(int i = start;list[i]!=0;++i){ + if(list[i]%list[start]!=0){ + newlist[count++]=list[i]; + } + } + int* temp = list; + list = newlist; + start++; + free(temp); + } + + int m,n ; + while(scanf("%d%d",&m,&n)!=EOF){ + for(int i = 0;list[i]!=0;++i){ + //printf("%d,",list[i]); + } + int flag = 0; + for(int i = 0;list[i]!=0;++i){ + if(list[i]>=m&&list[i]<=n){ + flag = 1; + printf("%d\n",list[i]); + } + } + if(flag==1)printf("\n"); + else if(flag==0)printf("\n\n"); + } + return 0; +} + +/************************************************************** + Problem: 1179 + User: 202211070518 + Language: C + Result: Accepted + Time:1072 ms + Memory:4652 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1180.c b/OpenJudge/QuestionAns/peerin/1180.c new file mode 100644 index 0000000..1f0aff9 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1180.c @@ -0,0 +1,64 @@ +#include +#include +#define MAX_SIZE 10000 +struct date{ + int year; + int month; + int day; +}; + +int get_date_array(struct date d[]){ + int n = 0; + while(scanf("%d/%d/%d",&d[n].month,&d[n].day,&d[n].year) != EOF){ + n++; + } + return n; +} + +int cmpdate(const void *a1,const void *a2){ + struct date *d1 = (struct date *)a1; + struct date *d2 = (struct date *)a2; + if(d1->year < d2->year) + return -1; + else if(d1->year > d2->year) + return 1; + else + if(d1->month < d2->month) + return -1; + else if(d1->month > d2->month) + return 1; + else + if(d1->day < d2->day) + return -1; + else if(d1->day > d2->day) + return 1; + else + return 0; +} + +void sort_date_array(struct date d[],int n){ + qsort(d,n,sizeof(int) * 3,cmpdate); +} + + +int main() +{ + struct date d_arr[MAX_SIZE]; + int cases = 0, i, j; + + cases = get_date_array(d_arr); + sort_date_array(d_arr, cases); + + for(i = 0; i < cases; i++) + printf("%02d/%02d/%d\n", d_arr[i].month, d_arr[i].day, d_arr[i].year); + return 0; +} +/************************************************************** + Problem: 1180 + User: 202211070518 + Language: C + Result: Accepted + Time:32 ms + Memory:800 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1184.c b/OpenJudge/QuestionAns/peerin/1184.c new file mode 100644 index 0000000..1036bdf --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1184.c @@ -0,0 +1,43 @@ +#include +#include + +int main() +{ + int n, a = 0; + while (scanf("%d", &n) != EOF) { + int ar[n][n]; + memset(ar, 0, sizeof ar); + int k = 1, i = 0, j = n - 1; + ar[i][j] = k++; + while (k <= n * n) { + while (i + 1 < n && !ar[i + 1][j]) + ar[++i][j] = k++; + while (j - 1 >= 0 && !ar[i][j - 1]) + ar[i][--j] = k++; + while (i - 1 >= 0 & !ar[i - 1][j]) + ar[--i][j] = k++; + while (j + 1 < n && !ar[i][j + 1]) + ar[i][++j] = k++; + } + if (a++) + printf("\n"); + for (i = 0; i < n; i++) { + for (j = 0; j < n; j++) + if (j) + printf(" %d", ar[i][j]); + else + printf("%d", ar[i][j]); + printf("\n"); + } + } +} + +/************************************************************** + Problem: 1184 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1187.c b/OpenJudge/QuestionAns/peerin/1187.c new file mode 100644 index 0000000..3f1bafb --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1187.c @@ -0,0 +1,45 @@ +#include +#include + +int get_digit_sum_as_string(char *s,int sum){ + int s_len = strlen(s); + + + if(s[0]=='\0'){ + return sum; + + } + else{ + int num = s[0]-'0'; + sum += num; + get_digit_sum_as_string(s+1,sum); + + + } +} + + + + +int main(){ + int n; + scanf("%d",&n); + for(int i = 0;i +#define MAX_STR_LEN 1001 + +int str_len(char s[]){ + int count = 0; + while(s[count++]!='\0') ; + return count-1; + +} + + +int main() +{ + int n; + char s[MAX_STR_LEN]; + while(gets(s) != NULL) + printf("%d\n", str_len(s)); + return 0; +} + +/************************************************************** + Problem: 1189 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1200.c b/OpenJudge/QuestionAns/peerin/1200.c new file mode 100644 index 0000000..45145d1 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1200.c @@ -0,0 +1,31 @@ +#include +#include +#include +#include +#define SWAP(a,b,t) t=a; a=b; b=t; + +int main() +{ + int n; + scanf("%d",&n); + int i; + double x; + for(i=0; i +#define MAX_SIZE 200 +#include +#include + +int main() +{ + int n; + scanf("%d",&n); + int i,k,j,l; + for(i=1;i<=n;++i) + { + double x; + scanf("%lf",&x); + double y=1.0/pow(cos(x),3); + printf("%.2lf\n",y); + } + + +} + + +/************************************************************** + Problem: 1206 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:760 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1207.c b/OpenJudge/QuestionAns/peerin/1207.c new file mode 100644 index 0000000..b4ac6c8 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1207.c @@ -0,0 +1,35 @@ +#include +int cac(int M){ + int sum = 0; + for(int i = 100;i<=999;++i){ + if(i%M==0&&(i/100!=i%10&&i/100!=(i%100)/10&&i%10!=(i%100)/10)) + sum += i; + + } + return sum; +} + + +int main(){ + int M; + int i = 0; + while(scanf("%d",&M)!=EOF){ + i++; + printf("case %d:%d\n",i,cac(M)); + + } + + + + return 0; +} + +/************************************************************** + Problem: 1207 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1208.c b/OpenJudge/QuestionAns/peerin/1208.c new file mode 100644 index 0000000..daa8a1b --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1208.c @@ -0,0 +1,52 @@ +#include +#include +#include + +int swap_any(void *s,void *t,size_t n){ + + char *tmp = (char *)malloc(n); + memcpy(tmp,t,n); + memcpy(t,s,n); + memcpy(s,tmp,n); + return 0; +} + + + +int main() +{ + int a, b; + double x, y; + char c, d; + char s[1001], t[1001]; + + gets(s); + gets(t); + swap_any(s, t, sizeof(s)); + printf("%s %s\n", s, t); + + c = getchar(); + getchar(); + d = getchar(); + getchar(); + swap_any(&c, &d, sizeof(char)); + printf("%c %c\n", c, d); + + scanf("%d %d", &a, &b); + swap_any(&a, &b, sizeof(int)); + printf("%d %d\n", a, b); + + scanf("%lf %lf", &x, &y); + swap_any(&x, &y, sizeof(double)); + printf("%lg %lg\n", x, y); +} + +/************************************************************** + Problem: 1208 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1212.c b/OpenJudge/QuestionAns/peerin/1212.c new file mode 100644 index 0000000..5b29f1f --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1212.c @@ -0,0 +1,55 @@ +#include +int multiply_recursive(int a,int b){ + + if(a==0||b==0){ + return 0; + } + else if(a==1){ + return b; + } + else if(a==-1){ + return -b; + } + else if(b==1){ + return a; + } + else if(b==-1){ + return -a; + } + else if(a>0){ + if(b>0){ + return multiply_recursive(a,b-1)+a; + } + else if(b<0){ + return -multiply_recursive(a,-b); + } + } + else if(a<0){ + if(b>0){ + return multiply_recursive(a,b-1)+a; + } + else if(b<0){ + return multiply_recursive(-a,-b); + + } + + } + +} +int main(){ + + int a,b; + scanf("%d%d",&a,&b); + printf("%d",multiply_recursive(a,b)); + +} + +/************************************************************** + Problem: 1212 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1213.c b/OpenJudge/QuestionAns/peerin/1213.c new file mode 100644 index 0000000..e210468 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1213.c @@ -0,0 +1,43 @@ +#include +#define MAX_STR_LEN 101 + + +int str_len(char *s){ + int len = 0; + while(s[len++] != '\0') ; + return len; +} + +char * str_cat(char *t,char *s){ + int i = 0; + int tL = str_len(t); + while(s[i] != '\0'){ + t[tL + i - 1] = s[i]; + i++; + } + t[tL + i - 1] = '\0'; + return t; +} + + +int main() +{ + char s[MAX_STR_LEN], str[MAX_STR_LEN], *p; + while(gets(s) != NULL && gets(str) != NULL) + { + p = str_cat(str, s); + puts(p); + puts(str); + } + return 0; +} + +/************************************************************** + Problem: 1213 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1214.c b/OpenJudge/QuestionAns/peerin/1214.c new file mode 100644 index 0000000..c2ea550 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1214.c @@ -0,0 +1,47 @@ +#include +#define MAX_STR_LEN 101 + + +int str_len(char *s){ + int len = 0; + while(s[len++] != '\0') ; + return len; +} + +char * str_cat(char *t,char *s,int n){ + int i = 0; + int tL = str_len(t); + while(s[i] != '\0' && n-- > 0){ + t[tL + i - 1] = s[i]; + i++; + } + t[tL + i - 1] = '\0'; + return t; +} + + + +int main() +{ + int n; + char s[MAX_STR_LEN], str[MAX_STR_LEN], *p; + while(scanf("%d", &n) != EOF && getchar()) + { + gets(s); + gets(str); + p = str_cat(str, s, n); + puts(p); + puts(str); + } + return 0; +} + +/************************************************************** + Problem: 1214 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1215.c b/OpenJudge/QuestionAns/peerin/1215.c new file mode 100644 index 0000000..b12e4b4 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1215.c @@ -0,0 +1,33 @@ +#include +#define MAX_STR_LEN 101 + +char * str_cpy(char * t,char * s){ + + int idxT = 0, idxS = 0; + while(s[idxS] != '\0') + t[idxT++] = s[idxS++]; + t[idxT] = '\0'; + return t; +} + + +int main() +{ + char s[MAX_STR_LEN], str[MAX_STR_LEN], *p; + while(gets(s) != NULL) + { + p = str_cpy(str, s); + puts(p); + puts(str); + } + return 0; +} +/************************************************************** + Problem: 1215 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1216.c b/OpenJudge/QuestionAns/peerin/1216.c new file mode 100644 index 0000000..0e07308 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1216.c @@ -0,0 +1,36 @@ +#include +#define MAX_STR_LEN 101 + +char * str_cpy(char * t,char * s,int n){ + + int idxT = 0, idxS = 0; + while(idxS < n && s[idxS] != '\0') + t[idxT++] = s[idxS++]; + t[idxT] = '\0'; + return t; +} + + +int main() +{ + int n; + char s[MAX_STR_LEN], str[MAX_STR_LEN], *p; + while(scanf("%d", &n) != EOF && getchar()) + { + gets(s); + p = str_cpy(str, s, n); + puts(p); + puts(str); + } + return 0; +} + +/************************************************************** + Problem: 1216 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1217.c b/OpenJudge/QuestionAns/peerin/1217.c new file mode 100644 index 0000000..7b63b84 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1217.c @@ -0,0 +1,37 @@ +#include + + +int myFloor(double data){ + + if(data==(int)data)return (int)data; + else + return data>0?(int)data:(int)(data-1); + + +} + + +int myCeil(double data){ + if(data==(int)data)return (int)data; + else + return myFloor(data+1); + + +} + +int main() +{ + double data; + while(scanf("%lf", &data) != EOF) + printf("%d %d\n", myFloor(data), myCeil(data)); + return 0; +} +/************************************************************** + Problem: 1217 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1220.c b/OpenJudge/QuestionAns/peerin/1220.c new file mode 100644 index 0000000..6fe0cb0 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1220.c @@ -0,0 +1,58 @@ +#include +#include + +typedef struct{ + int score[10];//选手的10个得分,得分与评委一一对应 + double aver;//选手的平均分 + char name[81];//选手的姓名 +}Choice; + +void inputChoice(Choice peo[],int m,int n){ + for(int i = 0;i < m;++i){ + scanf("%s",peo[i].name); + int max = 0,min = 100,res = 0; + for(int j = 0;j < n;++j){ + scanf("%d",&peo[i].score[j]); + if(peo[i].score[j] > max){ + max = peo[i].score[j]; + } + if(peo[i].score[j] < min){ + min = peo[i].score[j]; + } + res += peo[i].score[j]; + } + //printf("%s max:%d,min:%d\n",peo[i].name,max,min); + peo[i].aver = (res - max - min)/((n - 2) * 1.0); + } +} + +int choiceCmp(const void * n1,const void * n2){ + Choice * p1 = (Choice *)n1; + Choice * p2 = (Choice *)n2; + return -(p1->aver - p2->aver); +} + +void sort(Choice peo[],int m,int n){ + qsort(peo,m,sizeof(Choice),choiceCmp); +} + +int main() +{ + Choice peoples[30]; + int M,N,i; + scanf("%d%d",&M,&N); + inputChoice(peoples,M,N); + sort(peoples,M,N); + for (i=0; i<3; i++) + printf("%s %.2lf\n",peoples[i].name,peoples[i].aver); + return 0; +} +/************************************************************** + Problem: 1220 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1221.c b/OpenJudge/QuestionAns/peerin/1221.c new file mode 100644 index 0000000..0461237 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1221.c @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include + + +int main() +{ + int i, j; + int a; + + scanf("%d", &a); + for (i=0; i + + + +int maxValue(int a,int b,int c){ + + return a>=b?a>=c?a:c:b>=c?b:c; + + + +} + +int main() +{ + int x, y, z; + scanf("%d %d %d", &x, &y, &z); + printf("%d", maxValue(x, y, z)); + return 0; +} +/************************************************************** + Problem: 1224 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1228.c b/OpenJudge/QuestionAns/peerin/1228.c new file mode 100644 index 0000000..86c7a67 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1228.c @@ -0,0 +1,70 @@ +#include +#include +//两个整数的最大公约数等于其中较小的数和两数的差的最大公约数。 +//继续进行同样的计算可以不断缩小这两个数直至其中一个变成零 +//#define MAX 1000 +int min(int a,int b){ +int result; +if(a +#include +/* int is_primer(int num){ */ +/* if(num == 1) */ +/* return 0; */ +/* else if(num == 2 || num == 3 || num ==5 || num == 7) */ +/* return 1; */ +/* else if (num % 2 == 0) */ +/* return 0; */ +/* else if(num % 3 == 0) */ +/* return 0; */ +/* else if(num % 5 == 0) */ +/* return 0; */ +/* else if(num % 7 == 0) */ +/* return 0; */ +/* else */ +/* return 1; */ + + +/* } */ + +int is_primer(int num){ + if(num == 1) + return 0; + int n = sqrt(num); + for(int i = 2;i<=n;++i){ + if(num%i==0) + return 0; + + } + return 1; +} + + +int main() +{ + int num; + while(scanf("%d", &num) != EOF) + { + if(is_primer(num)) + puts("YES"); + else + puts("NO"); + } + return 0; +} +/************************************************************** + Problem: 1233 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:756 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1234.c b/OpenJudge/QuestionAns/peerin/1234.c new file mode 100644 index 0000000..074d0b2 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1234.c @@ -0,0 +1,32 @@ +#include +#include +#define MAX_STR_LEN 101 + +char *revs(char *s){ + int len = strlen(s); + char s2[MAX_STR_LEN]; + for(int i = len - 1;i >= 0;--i){ + s2[i] = s[len - i - 1]; + } + s2[len] = '\0'; + strcpy(s,s2); + return s; +} + +int main() +{ + char s[MAX_STR_LEN]; + gets(s); + revs(s); + puts(s); + return 0; +} +/************************************************************** + Problem: 1234 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1235.c b/OpenJudge/QuestionAns/peerin/1235.c new file mode 100644 index 0000000..d7e68fa --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1235.c @@ -0,0 +1,32 @@ +#include +#include +#define MAX_STR_LEN 101 + +char *str_rev(char *t,char *s){ + int len = strlen(s); + for(int i = len - 1;i >= 0;--i){ + t[i] = s[len - i - 1]; + } + t[len] = '\0'; + return t; +} + + +int main() +{ + char s[MAX_STR_LEN], str[MAX_STR_LEN], *p; + gets(s); + p = str_rev(str, s); + puts(p); + puts(str); + return 0; +} +/************************************************************** + Problem: 1235 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1236.c b/OpenJudge/QuestionAns/peerin/1236.c new file mode 100644 index 0000000..ff18859 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1236.c @@ -0,0 +1,32 @@ +#include + + +int get_int_sum(int *a,int *b){ + + scanf("%d%d",a,b); + return *a+*b; + + +} + +int main() +{ + int n, a, b, i; + scanf("%d", &n); + for(i = 1; i <= n; i++) + { + printf("%d = ", get_int_sum(&a, &b)); + printf("%d + %d\n", a, b); + + } + return 0; +} +/************************************************************** + Problem: 1236 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1238.c b/OpenJudge/QuestionAns/peerin/1238.c new file mode 100644 index 0000000..1238ab9 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1238.c @@ -0,0 +1,18 @@ +#include + +int main(){ +double a,b,c; +scanf("%lf%lf%lf",&a,&b,&c); +printf("%g",a*b*c); +return 0; +} + +/************************************************************** + Problem: 1238 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1240.c b/OpenJudge/QuestionAns/peerin/1240.c new file mode 100644 index 0000000..fc2bfc6 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1240.c @@ -0,0 +1,26 @@ +#include +int put_int_sum(int a,int b){ +if(a == 0 && b ==0) + return 0; +else{ + printf("%d\n",a+b); +return 1; +} +} +int main() +{ + int a, b; + while(scanf("%d%d", &a, &b)) + if(put_int_sum(a, b) == 0) + break; + return 0; +} +/************************************************************** + Problem: 1240 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1241.c b/OpenJudge/QuestionAns/peerin/1241.c new file mode 100644 index 0000000..dba2135 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1241.c @@ -0,0 +1,38 @@ +#include + +int compare(int *min, int *mid, int *max){ + int arr[3]={*min,*mid,*max}; + for(int i = 0;i<3;++i){ + for(int j = i+1;j<3;++j){ + if(arr[j] +#include +#include +unsigned int conv(char input[]){ + + unsigned int input_len = strlen(input); + + unsigned int result = 0; + + for(int i = input_len-1;i >= 0;--i){ + //0101 4 4-(3+1) + // + result += (input[i]-'0')*(int)pow(2.0,(input_len-(i*1.0+1))); + //printf("%u\n",result); + + } + + return result; + +} + + +int main(){ + + char input[33]={0}; + while(scanf("%s",&input)!=EOF){ + + printf("%u\n",conv(input)); + + + } + + return 0; +} + +/************************************************************** + Problem: 1242 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:760 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1244.c b/OpenJudge/QuestionAns/peerin/1244.c new file mode 100644 index 0000000..893e444 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1244.c @@ -0,0 +1,24 @@ +#include + +int main(){ + int sec; + while(scanf("%d",&sec)!=EOF&&sec!=0){ + sec--; + double hour = sec/60.0/60.0; + double min = (sec - (int)hour*3600)/60.0; + int sec_left = sec - (int)hour*3600-(int)min*60; + printf("%02d:%02d:%02d\n",(int)hour,(int)min,sec_left); + + } + return 0; +} + +/************************************************************** + Problem: 1244 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1245.c b/OpenJudge/QuestionAns/peerin/1245.c new file mode 100644 index 0000000..e2cd3f7 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1245.c @@ -0,0 +1,39 @@ +#include + + +void hanoi_tower(int number,int begin,int temp,int destination){ + + if(number == 0){ + ; +} + else { + hanoi_tower(number-1,begin,destination,temp); + printf(" plate %d : from %d to %d\n",number,begin,destination); + hanoi_tower(number-1,temp,begin,destination); + } + +} + +int main(){ + + int number,begin,temp,destination; + int count=0; + while(scanf("%d%d%d%d",&number,&begin,&temp,&destination)!=EOF){ + count++; + printf("case %d :\n",count); + hanoi_tower(number,begin,temp,destination); + printf("\n"); + } + return 0; + +} + +/************************************************************** + Problem: 1245 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1247.c b/OpenJudge/QuestionAns/peerin/1247.c new file mode 100644 index 0000000..24ed53f --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1247.c @@ -0,0 +1,53 @@ +#include +#include +#include + +int mystrcmp(char *s,char *t){ + int slen = strlen(s); + int tlen = strlen(t); + if(slen==tlen) + return strcmp(s,t); + else + return slen - tlen; +} + +int main(){ + int N; + scanf("%d",&N); + char *a[50000],t[100001]; + int i,j,len; + for(i = 0;i < N;++i){ + scanf("%s",t); + //gets(t); + //getchar(); + len = strlen(t); + a[i] = (char *)malloc(sizeof(char)*(len+1)); + strcpy(a[i],t); + } + for(i = 0;i < N-1;++i){ + for(j = i + 1;j < N;++j){ + if(mystrcmp(a[i],a[j])>0){ + char *tmp = a[i]; + a[i] = a[j]; + a[j] = tmp; + } + } + } + for(i = 0;i < N;++i){ + printf("%s\n",a[i]); + free(a[i]); + } + return 0; +} + + + +/************************************************************** + Problem: 1247 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:968 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1250.c b/OpenJudge/QuestionAns/peerin/1250.c new file mode 100644 index 0000000..ddfa819 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1250.c @@ -0,0 +1,29 @@ +#include +#include +#include +int main() +{ + int n; + scanf("%d",&n); + int i; + for(i=0;i +#include +#include +int main() +{ + int n; + scanf("%d",&n); + int i; + double x1,y1,x2,y2,x3,y3,a; + for(i=0;i + +int main(){ +int a; +scanf("%d",&a); +printf(" a : %d\n--a : %d\n a-- : %d\n a++ : %d\n++a : %d\n",a,a-1,a,a,a+1); +return 0; +} + +/************************************************************** + Problem: 1252 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1253.c b/OpenJudge/QuestionAns/peerin/1253.c new file mode 100644 index 0000000..898304d --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1253.c @@ -0,0 +1,28 @@ +#include +#include + +int main(){ + +char s[11]; +scanf("%s",s); +int k; +scanf("%d",&k); + +int len = strlen(s); +if(k>len) printf("error\n"); +else printf("%c\n",s[k-1]); + +return 0; +} + + + +/************************************************************** + Problem: 1253 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1254.c b/OpenJudge/QuestionAns/peerin/1254.c new file mode 100644 index 0000000..0c159a9 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1254.c @@ -0,0 +1,63 @@ +#include +#include +#include +#include + +int main() +{ + int m,n; + int i,j,l,h; + double sum_hang, sum_lie; + double a[52][12]; + char b[52][8]; + char c[11][8]; + char temp1,temp2; + scanf("%d %d", &m, &n); + for(l=0; l +#define MAX_SIZE 1000 + +int getarray(int arr[]){ + + int size; + scanf("%d",&size); + int i; + for(i = 0;i + +typedef enum{ + diamond = 1,//方块 + club = 2,//梅花 + spade = 3,//黑桃 + heart = 4//红桃 +} Cards; + +typedef struct { + Cards type; + int point; +} Poker; + +int get_card(Poker *pk){ + char cT; + scanf("%c",&cT); + if(cT == ' '){ + scanf("%c",&cT); + } + switch(cT){ + case 'D': + pk->type = heart; + break; + case 'C': + pk->type = spade; + break; + case 'B': + pk->type = club; + break; + case 'A': + pk->type = diamond; + } + scanf("%d",&pk->point); + return 0; +} + +int card_cmp(Poker p1, Poker p2){ + if(p1.point == p2.point){ + if(p1.type == p2.type){ + return 0; + } + else{ + return (p1.type > p2.type) ? 1 : -1; + } + } + else{ + return (p1.point > p2.point) ? 1 : -1; + } +} + + +int main() +{ + Poker tom, jack; + get_card(&tom); + get_card(&jack); + + int result = card_cmp(tom, jack); + if(result > 0) + puts("Tom wins."); + if(result < 0) + puts("Jack wins."); + if(result == 0) + puts("Tie."); +} +/************************************************************** + Problem: 1268 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1271.c b/OpenJudge/QuestionAns/peerin/1271.c new file mode 100644 index 0000000..10b033c --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1271.c @@ -0,0 +1,127 @@ +#include + +/* int digit_sum_1(int num){ */ +/* //4294967295 */ +/* if(num>=1&&num<10){ */ +/* return num; */ +/* }else if(num >=10 && num <100){ */ +/* int gw,sw; */ +/* gw = num%10; */ +/* sw = num/10; */ +/* return gw+sw; */ +/* }else if(num>=100&&num<1000){ */ +/* int gw,sw,bw; */ +/* gw = num%10; */ +/* sw = (num/10)%10; */ +/* bw = num/100; */ +/* return gw+sw+bw; */ +/* }else if(num>=1000&&num<10000){ */ +/* int gw,sw,bw,qw; */ +/* gw = num%10; */ +/* sw = (num/10)%10; */ +/* bw = (num/100)%10; */ +/* qw = num/1000; */ +/* return gw+sw+bw+qw; */ +/* }else if(num>=10000&&num<100000){ */ +/* int gw,sw,bw,qw,ww; */ +/* gw = num%10; */ +/* sw = (num/10)%10; */ +/* bw = (num/100)%10; */ +/* qw = (num/1000)%10; */ +/* ww = num/10000; */ +/* return gw+sw+bw+qw+ww; */ +/* }else if(num>=100000&&num<1000000){ */ +/* int gw,sw,bw,qw,ww,sww; */ +/* gw = num%10; */ +/* sw = (num/10)%10; */ +/* bw = (num/100)%10; */ +/* qw = (num/1000)%10; */ +/* ww = (num/10000)%10; */ +/* sww = num/100000; */ +/* return gw+sw+bw+qw+ww+sww; */ +/* }else if(num>=1000000&&num<10000000){ */ +/* int gw,sw,bw,qw,ww,sww,bww; */ +/* gw = num%10; */ +/* sw = (num%10)/10; */ +/* bw = (num/100)%10; */ +/* qw = (num/1000)%10; */ +/* ww = (num/10000)%10; */ +/* sww = (num/100000)%10; */ +/* bww = num/1000000; */ + +/* return gw+sw+bw+qw+ww+sww+bww; */ + +/* }else if(num>=10000000&&num<100000000){ */ +/* int gw,sw,bw,qw,ww,sww,bww,qww; */ +/* gw = num%10; */ +/* sw = (num%10)/10; */ +/* bw = (num/100)%10; */ +/* qw = (num/1000)%10; */ +/* ww = (num/10000)%10; */ +/* sww = (num/100000)%10; */ +/* bww = (num/1000000)%10; */ +/* qww = num/10000000; */ + +/* return gw+sw+bw+qw+ww+sww+bww+qww; */ +/* } */ +/* else if(num>=100000000&&num<1000000000){ */ +/* int gw,sw,bw,qw,ww,sww,bww,qww,yw; */ +/* gw = num%10; */ +/* sw = (num%10)/10; */ +/* bw = (num/100)%10; */ +/* qw = (num/1000)%10; */ +/* ww = (num/10000)%10; */ +/* sww = (num/100000)%10; */ +/* bww = (num/1000000)%10; */ +/* qww = (num/10000000)%10; */ +/* yw = num/100000000; */ + +/* return gw+sw+bw+qw+ww+sww+bww+qww+yw; */ +/* }else if(num>=1000000000&&num<10000000000u){ */ +/* int gw,sw,bw,qw,ww,sww,bww,qww,yw,syw; */ +/* gw = num%10; */ +/* sw = (num%10)/10; */ +/* bw = (num/100)%10; */ +/* qw = (num/1000)%10; */ +/* ww = (num/10000)%10; */ +/* sww = (num/100000)%10; */ +/* bww = (num/1000000)%10; */ +/* qww = (num/10000000)%10; */ +/* yw = (num/100000000)%10; */ +/* syw = num/1000000000; */ + +/* return gw+sw+bw+qw+ww+sww+bww+qww+yw+syw; */ +/* } */ +/* } */ + +int digit_sum_1(int num){ + if(num<10) + return num; + else + return num%10+digit_sum_1(num/10); + +} +int digit_sum(int num){ + if(num < 10) + return num; + else + return digit_sum(digit_sum_1(num)); + +} + +int main() +{ + int n; + scanf("%d", &n); + printf("%d", digit_sum(n)); + return 0; +} +/************************************************************** + Problem: 1271 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1276.c b/OpenJudge/QuestionAns/peerin/1276.c new file mode 100644 index 0000000..2f807ed --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1276.c @@ -0,0 +1,70 @@ +#include + +int print_line(int total_num,int blank_num){ + + int half_star_num =(total_num - blank_num)/2; + for(int i = 0;i=0;--i){ + if(i==0){ + for(int j = 0;j + + +int is_daffodil(int n){ + if(n<100||n>=1000)return 0; + + int gw = n%10; + int sw = (n/10)%10; + int bw = (n/100); + if(n == gw*gw*gw+sw*sw*sw+bw*bw*bw){ + + return 1; + + }else return 0; + + + + + +} + + +int main() +{ + int n; + scanf("%d", &n); + printf("%s", + ( is_daffodil(n) ? "Yes, it is a daffodil." + : "No, it is not a daffodil." ) + ); + return 0; +} +/************************************************************** + Problem: 1278 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1286.c b/OpenJudge/QuestionAns/peerin/1286.c new file mode 100644 index 0000000..d8eef95 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1286.c @@ -0,0 +1,60 @@ +#include +#define MAX_SIZE 101 + +int get_matrix(int ma[][MAX_SIZE], int m, int n) +{ + int i, j; + for (i = 0; i < m; i++) + for (j = 0; j < n; j++) + scanf("%d", &ma[i][j]); +} + +int put_matrix(int ma[][MAX_SIZE], int m, int n) +{ + int i, j; + for (i = 0; i < m; i++) { + for (j = 0; j < n; j++) + if (j == 0) + printf("%d", ma[i][j]); + else + printf(" %d", ma[i][j]); + printf("\n"); + } +} + +int mul_matrix(int pr[][MAX_SIZE], int m1[][MAX_SIZE], int m2[][MAX_SIZE], int m, int n, int q) +{ + int i, j, k; + for (i = 0; i < m; i++) + for (j = 0; j < q; j++) { + pr[i][j] = 0; + for (k = 0; k < n; k++) + pr[i][j] += (m1[i][k] * m2[k][j]); + } +} + + +int main() +{ + int m, n, q; + int product[MAX_SIZE][MAX_SIZE]; + int matrix1[MAX_SIZE][MAX_SIZE]; + int matrix2[MAX_SIZE][MAX_SIZE]; + + scanf("%d%d%d", &m, &n, &q); + get_matrix(matrix1, m, n); + get_matrix(matrix2, n, q); + mul_matrix(product, matrix1, matrix2, m, n, q); + put_matrix(product, m, q); + + return 0; +} +/************************************************************** + Problem: 1286 + User: 202211070518 + Language: C + Result: Accepted + Time:20 ms + Memory:796 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1298.c b/OpenJudge/QuestionAns/peerin/1298.c new file mode 100644 index 0000000..63c875a --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1298.c @@ -0,0 +1,32 @@ +#include +int gcd(int m,int n){ + if(m==0) + return n; + else if(n==0) + return m; + else if(m%n==0){ + return n; + }else{ + return gcd(n,m%n); + } +} +int lcm(int m,int n){ + return m/gcd(m,n)*n; +} + +int main(){ + + int m,n; + scanf("%d%d",&m,&n); + printf("%d %d",gcd(m,n),lcm(m,n)); +} + +/************************************************************** + Problem: 1298 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1301.c b/OpenJudge/QuestionAns/peerin/1301.c new file mode 100644 index 0000000..69cc0d4 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1301.c @@ -0,0 +1,92 @@ +#include +#include +#include +#include + + +char a[109]; + +int sum2(int k) +{ + int u,ne=1,s=0; + for(u=k-1;u>=0;--u) + { + s=s+(a[u]-'0')*ne; + ne=ne*10; + } + return s; +} + +int sum3(int k,int m) +{ + int u,ne=1,s=0; + for(u=k-1;u>m;--u) + { + s=s+(a[u]-'0')*ne; + ne=ne*10; + } + return s; +} +int main() +{ + + while(gets(a)!=NULL) + { + int sum[10],m=0,i,k; + int l=strlen(a); + int flag3=0; + for(i=0; i='0')); + else + { + // printf("NO\n"); + flag3=1; + } + if(a[i]=='.') + { + sum[m]=i; + ++m; + } + } + if(flag3==1) + { + printf("NO\n"); + continue; + } + if(m!=3) + { + printf("NO\n"); + continue; + } + if(sum[1]-sum[0]<=4&&sum[1]-sum[0]>=2 && sum[0]>=1 && sum[0]<=3 && sum[2]-sum[1]<=4&&sum[2]-sum[1]>=2 && l-sum[2]>=2 &&l-sum[2]<=4); + else + { + printf("NO\n"); + continue; + } + int flag=0; + int v=0; + for(k=0;k<=3;++k) + { + if(k==0) v=sum2(sum[k]); + else if(k==3) v=sum3(l,sum[2]); + else v=sum3(sum[k],sum[k-1]); + if(v>=0 && v<=255) flag++; + } + if(flag==4) printf("YES\n"); + else printf("NO\n"); + } + +} + + +/************************************************************** + Problem: 1301 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1334.c b/OpenJudge/QuestionAns/peerin/1334.c new file mode 100644 index 0000000..2fc07ec --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1334.c @@ -0,0 +1,39 @@ +#include +#include +#include + +int main() +{ + int N, i = 0, j, l, m; + char** str; + char* t; + char tp[100001]; + scanf("%d", &N); + getchar(); + str = (char**)malloc(sizeof(char*) * (N + 1)); + for (i = 0; i < N; i++) { + gets(tp); + l = strlen(tp); + str[i] = (char*)malloc(sizeof(char) * (l + 1)); + strcpy(str[i], tp); + } + for (i = 0; i < N - 1; i++) + for (j = 0; j < N - 1 - i; j++) + if (strcmp(str[j], str[j + 1]) > 0) { + t = str[j]; + str[j] = str[j + 1]; + str[j + 1] = t; + } + for (i = 0; i < N; i++) + puts(str[i]); +} + +/************************************************************** + Problem: 1334 + User: 202211070518 + Language: C + Result: Accepted + Time:6532 ms + Memory:1356 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1337.c b/OpenJudge/QuestionAns/peerin/1337.c new file mode 100644 index 0000000..a48c11c --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1337.c @@ -0,0 +1,34 @@ +#include +#define MAX_STR_LEN 1001 + +int str_chr(char s[], char ch){ + + for(int idx = 0;s[idx] != '\0';++idx){ + if(s[idx] == ch) + return idx; + } + return -1; +} + + +int main() +{ + char ch; + char s[MAX_STR_LEN]; + while(gets(s) != NULL) + { + ch = getchar(); + printf("%d\n", str_chr(s, ch)); + gets(s); // 仅用于读出字符后的换行符,以确保while循环内gets读到正确的数据,无其他意义,于理解题意无关。 + } + return 0; +} +/************************************************************** + Problem: 1337 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1347.c b/OpenJudge/QuestionAns/peerin/1347.c new file mode 100644 index 0000000..f022fda --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1347.c @@ -0,0 +1,54 @@ +#include +#include +int main(){ +char c; +scanf("%c",&c); +switch(c){ +case 'a': + printf("yes"); + break; +case 'e': + printf("yes"); + break; + + case 'i': + + printf("yes"); + break; + case 'o': + printf("yes"); + break; + case 'u': + printf("yes"); + break; + case 'A': + printf("yes"); + break; + case 'E': + printf("yes"); + break; + case 'I': + printf("yes"); + break; + case 'O': + printf("yes"); + break; + case 'U': + printf("yes"); + break; + default: + printf("no"); +} + +return 0; +} + +/************************************************************** + Problem: 1347 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1368.c b/OpenJudge/QuestionAns/peerin/1368.c new file mode 100644 index 0000000..379a459 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1368.c @@ -0,0 +1,55 @@ +#include +struct CPLX{ + int real; + int virtual; +}; + +void get_cplx(struct CPLX *cplx){ + scanf("%d%d",&cplx->real,&cplx->virtual); +} + +void put_cplx(struct CPLX cplx){ + printf("%d %d\n",cplx.real,cplx.virtual); +} + +struct CPLX add_cplx(struct CPLX n1,struct CPLX n2){ + struct CPLX res = { + n1.real + n2.real, + n1.virtual + n2.virtual + }; + return res; +} + +struct CPLX sub_cplx(struct CPLX n1,struct CPLX n2){ + struct CPLX res = { + n1.real - n2.real, + n1.virtual - n2.virtual + }; + return res; +} + + + +int main() +{ + struct CPLX ab, cd; + int cases; + scanf("%d", &cases); + while(cases--) + { + get_cplx(&ab); + get_cplx(&cd); + put_cplx( add_cplx(ab, cd) ); + put_cplx( sub_cplx(ab, cd) ); + } + return 0; +} +/************************************************************** + Problem: 1368 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1370.c b/OpenJudge/QuestionAns/peerin/1370.c new file mode 100644 index 0000000..fb381cc --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1370.c @@ -0,0 +1,43 @@ +#include +#include +#define MAX_STR_LEN 101 + +char * str_cat(char *t,char *s){ + int idx = 0,idx2 = 0; + char *n = malloc(sizeof(char) * MAX_STR_LEN * 2); + while(t[idx] != '\0'){ + n[idx] = t[idx]; + idx++; + } + + while(s[idx2] != '\0'){ + n[idx + idx2] = s[idx2]; + idx2++; + } + n[idx + idx2] = '\0'; + return n; +} + + +int main() +{ + char s[MAX_STR_LEN], str[MAX_STR_LEN], *p; + while(gets(s) != NULL && gets(str) != NULL) + { + p = str_cat(str, s); + puts(str); + puts(s); + puts(p); + free(p); + } + return 0; +} +/************************************************************** + Problem: 1370 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1375.c b/OpenJudge/QuestionAns/peerin/1375.c new file mode 100644 index 0000000..436c7d6 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1375.c @@ -0,0 +1,25 @@ +#include +int add(int n){ +static sum = 0; +sum += n; +return sum; +} + +int main() +{ + int min, max, sum; + scanf("%d%d", &min, &max); + while(min <= max) + sum = add(min++); + printf("%d", sum); + return 0; +} +/************************************************************** + Problem: 1375 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1376.c b/OpenJudge/QuestionAns/peerin/1376.c new file mode 100644 index 0000000..0e24d43 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1376.c @@ -0,0 +1,51 @@ +#include +#define MAX_SIZE 100 + +int get_array(int a[]){ + int i = 0; + while(scanf("%d",a+i++)!=EOF) ; + return i-1; +} + +int put_array(int a[],int n){ + for(int i = 0;i + + +int get_num(int *a,int *b,int *c){ + + return scanf("%d %d %d",a,b,c); + +} + +int max_min(int *max,int *min,int a,int b,int c){ + + *max = a; + *min = a; + + int ar[3]={a,b,c}; + int i; + for(i = 0;i < 3;++i){ + if(ar[i]>*max){ + *max = ar[i]; + } + if(ar[i]<*min){ + *min = ar[i]; + } + } + + return 0; +} + + +int main() +{ + int cases, i; + int mmax, mmin, a, b, c; + + scanf("%d", &cases); + for(i = 1; i <= cases; i++) + { + get_num(&a, &b, &c); + max_min(&mmax, &mmin, a, b, c); + printf("case %d : %d, %d\n", i, mmax, mmin); + } +} + +/************************************************************** + Problem: 1382 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1383.c b/OpenJudge/QuestionAns/peerin/1383.c new file mode 100644 index 0000000..96c586f --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1383.c @@ -0,0 +1,69 @@ +#include +#include + +double * allocate(int n){ + + return (double *)malloc(sizeof(double)*n); + +} + +void output(double *p, int N){ + int m,n; + scanf("%d%d",&m,&n); + if(m>n){ + int temp = m; + m = n; + n = temp; + } + int f = 0,bg,ed; + if(m<1) + bg = 0; + else + bg = m-1; + if(n>N) + ed = N; + else + ed = n; + + int i; + for(i = bg;i < ed;++i){ + f = 1; + printf("%g\n",p[i]); + } + if(f==0){ + printf("no output\n"); + } + +} + +void input(double *p, int N){ + int i; + for(i = 0;i < N;++i){ + scanf("%lf",p+i); + } +} + +void release(double *p){ + free(p); +} + + +int main() +{ + int len; + double *array; + scanf("%d", &len); + array = allocate(len); + input(array, len); + output(array, len); + release(array); +} +/************************************************************** + Problem: 1383 + User: 202211070518 + Language: C + Result: Accepted + Time:68 ms + Memory:3092 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1384.c b/OpenJudge/QuestionAns/peerin/1384.c new file mode 100644 index 0000000..2df2c13 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1384.c @@ -0,0 +1,30 @@ +#include +int jc(int n){ + if(n<=1){ + return 1; + }else{ + return n*jc(n-1); + } + + +} + + + +int main(){ + int n; + scanf("%d",&n); + printf("%d",jc(n)); + + return 0; +} + +/************************************************************** + Problem: 1384 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1398.c b/OpenJudge/QuestionAns/peerin/1398.c new file mode 100644 index 0000000..5be9ad4 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1398.c @@ -0,0 +1,19 @@ +#include + +int main(){ + +printf("Hello world!\n"); + + +return 0; +} + +/************************************************************** + Problem: 1398 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:744 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1400.c b/OpenJudge/QuestionAns/peerin/1400.c new file mode 100644 index 0000000..dab0b1e --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1400.c @@ -0,0 +1,18 @@ +#include + +int main(){ +int a,b; +scanf("%d%d",&a,&b); +printf("%d\n%d",a+b,a-b); +return 0; +} + +/************************************************************** + Problem: 1400 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1403.c b/OpenJudge/QuestionAns/peerin/1403.c new file mode 100644 index 0000000..9b1ec55 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1403.c @@ -0,0 +1,27 @@ +#include +#include +int main(){ +double n; +scanf("%lf",&n); +double n_ = sqrt(n); +if(n_==(int)n_){ + if((int)n%2==0){ + if(n>0){ + printf("yes"); +return 0; + } + } +} +printf("no"); +return 0; +} + +/************************************************************** + Problem: 1403 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:756 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1404.c b/OpenJudge/QuestionAns/peerin/1404.c new file mode 100644 index 0000000..8ee93e1 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1404.c @@ -0,0 +1,25 @@ +#include +#include +int main(){ +int P_1,P_2,P_3,P_s; +int R_1,R_2,R_3; +scanf("%d%d%d%d",&P_1,&P_2,&P_3,&P_s); +scanf("%d%d%d",&R_1,&R_2,&R_3); +if(R_1 +#include +#include +int main(){ +int k,s,n; +scanf("%d",&k); +s = 0; +int i = 0; +for(i = 0;i +#include +#include +int main(){ + int n,sum; + sum = 0; + int count = 0; +while(scanf("%d",&n)!=EOF){ + sum+=n; + count++; +} +printf("%.3f",sum/(double)count); +return 0; +} + +/************************************************************** + Problem: 1417 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1434.c b/OpenJudge/QuestionAns/peerin/1434.c new file mode 100644 index 0000000..f3b491a --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1434.c @@ -0,0 +1,65 @@ +#include +#include + +int main() +{ + int m, n, i, j, k, kp; + double t; + double a[51][51], b[51], c[51]; + scanf("%d", &m); + for (kp = 1; kp <= m; kp++) { + scanf("%d", &n); + for (j = 1; j <= n; j++) { + for (i = 1; i <= n; i++) { + scanf("%lf", &a[j][i]); + } + scanf("%lf", &b[j]); + } + if (kp != 1) + printf("\n"); + for (j = 1; j <= n - 1; j++) { + if (a[j][j] == 0) { + for (i = j + 1; i <= n; i++) { + if (a[i][j] != 0) { + for (k = 1; k <= n; k++) { + a[i][k] += a[j][k]; + a[j][k] = a[i][k] - a[j][k]; + a[i][k] -= a[j][k]; + } + b[i] += b[j]; + b[j] = b[i] - b[j]; + b[i] -= b[j]; + } + continue; + } + } + } + for (j = 1; j <= n - 1; j++) { + for (i = j + 1; i <= n; i++) { + t = a[i][j] / a[j][j]; + b[i] = b[i] - t * b[j]; + for (k = 1; k <= n; k++) + a[i][k] = a[i][k] - t * a[j][k]; + } + } + + c[n] = b[n] / a[n][n]; + for (j = n - 1; j >= 1; --j) { + c[j] = b[j]; + for (k = n; k >= j + 1; --k) + c[j] = c[j] - c[k] * a[j][k]; + c[j] = c[j] / a[j][j]; + } + for (j = 1; j <= n; ++j) + printf("x%d=%.3lf\n", j, c[j]); + } +} +/************************************************************** + Problem: 1434 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1455.c b/OpenJudge/QuestionAns/peerin/1455.c new file mode 100644 index 0000000..2203d16 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1455.c @@ -0,0 +1,27 @@ +#include + +int main(){ + /* int sec; */ + /* while(scanf("%d",&sec)!=EOF&&sec!=0){ */ + /* double hour = sec/60.0/60.0; */ + /* double min = (sec - (int)hour*3600)/60.0; */ + /* int sec_left = sec - (int)hour*3600-(int)min*60; */ + /* printf("%d:%d:%d",(int)hour,(int)min,sec_left); */ + + /* } */ + int hour,min,sec; + while (scanf("%d:%d:%d",&hour,&min,&sec)!=EOF){ + printf("%d\n",hour*3600+min*60+sec+1); + } + return 0; +} + +/************************************************************** + Problem: 1455 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1457.c b/OpenJudge/QuestionAns/peerin/1457.c new file mode 100644 index 0000000..cfabe4a --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1457.c @@ -0,0 +1,55 @@ +#include + +void prsp(int n) +{ + int i; + for (i = 1; i <= n; i++) { + printf(" "); + } +} + +void prsz(int n) +{ + int i; + for (i = 1; i <= n; i++) { + printf("%d", i); + } + for (i -= 2; i >= 1; i--) { + printf("%d", i); + } +} + +int main() +{ + int i, n; + scanf("%d", &n); + for (i = 1; i <= n; i++) { + prsp(n - i); + prsz(i); + printf("\n"); + } + for (i -= 2; i >= 1; i--) { + prsp(n - i); + prsz(i); + printf("\n"); + } +} +/************************************************************** + Problem: 1457 + User: 202001060117 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + + +/************************************************************** + Problem: 1457 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1458.c b/OpenJudge/QuestionAns/peerin/1458.c new file mode 100644 index 0000000..f7b3a6e --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1458.c @@ -0,0 +1,32 @@ +#include + +int main(){ + int n; + scanf("%d",&n); + int i; + int array[n]; +for(i = 0;in-1||index < 1)printf("OUT OF RANGE\n"); + else{ + printf("%d\n",array[index-1]); + + } + + } + + +} + +/************************************************************** + Problem: 1458 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1459.c b/OpenJudge/QuestionAns/peerin/1459.c new file mode 100644 index 0000000..9c608be --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1459.c @@ -0,0 +1,54 @@ +#include + + + +int find(int list[],int num,int len){ + + /* if(list[len/2]==num)return list[len/2]; */ + /* else if(len==0){return -1;} */ + /* else{ */ + /* return find(list,num,len/2); */ + /* } */ + + + for(int i = 0;i < len;++i){ + if(list[i]==num)return i+1; + } + return -1; +} + + + +int main(){ + + int n; + scanf("%d",&n); + int list[n]; + for(int i = 0;i + +int find(int list[],int num,int len){ + + for(int i = len-1;i >= 0;--i){ + if(list[i]==num)return i+1; + } + return -1; +} + + + +int main(){ + + int n; + scanf("%d",&n); + int list[n]; + for(int i = 0;i + + + +int main(){ + + int n; + scanf("%d",&n); + int list[n]; + for(int i = 0;i=0?i:-i)>n?-1:list[i>0?i-1:n+i]; + if(res==-1){ + printf("OUT OF RANGE\n"); + }else{ + printf("%d\n",res); + } + + } +} + +/************************************************************** + Problem: 1461 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1462.c b/OpenJudge/QuestionAns/peerin/1462.c new file mode 100644 index 0000000..3bde7fa --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1462.c @@ -0,0 +1,60 @@ +#include +/* int find(int list[],int num,int begin,int len,int result[],int count){ */ + +/* for(int i = begin;i < len;++i){ */ +/* if(list[i]==num){ */ +/* result[count++]==i; */ +/* } */ + +/* } + + + + }*/ + +int main(){ + + int n; + scanf("%d",&n); + int list[n]; + for(int i = 0;i < n;++i){ + + scanf("%d",list+i); + + } + int num; + while(scanf("%d",&num)!=EOF){ + + int number = 0; + for(int i = 0;i < n;++i){ + if(list[i]==num)number++; + } + int flag = 0; + int count = 0; + for(int i = 0;i < n;++i){ + if(list[i]==num){ + flag = 1; + count++; + if(count != number) + printf("%d ",i+1); + else + printf("%d\n",i+1); + } + } + if(flag == 0){ + printf("NOT FOUND\n"); + } + } + + return 0; +} + +/************************************************************** + Problem: 1462 + User: 202211070518 + Language: C + Result: Accepted + Time:88 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1463.c b/OpenJudge/QuestionAns/peerin/1463.c new file mode 100644 index 0000000..2b28d0d --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1463.c @@ -0,0 +1,28 @@ +#include +int sum(int a, int b){ +int result; +result = a+b; + +return result; +} + + +int main() +{ + int a, b; + + while(scanf("%d%d", &a, &b) != EOF) + printf("%d\n", sum(a, b)); + + return 0; +} + +/************************************************************** + Problem: 1463 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1464.c b/OpenJudge/QuestionAns/peerin/1464.c new file mode 100644 index 0000000..01b4d86 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1464.c @@ -0,0 +1,26 @@ +#include +int put_sum(int a,int b){ +printf("%d\n",a+b); + +return 0; +} + + +int main() +{ + int a, b; + + while(scanf("%d%d", &a, &b) != EOF) + put_sum(a, b); + + return 0; +} +/************************************************************** + Problem: 1464 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1465.c b/OpenJudge/QuestionAns/peerin/1465.c new file mode 100644 index 0000000..84c57f1 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1465.c @@ -0,0 +1,27 @@ +#include + +int is_leap_year(int year){ + +return (year%4==0&&year%100!=0)||year%400==0?1:0; + +} + + +int main() +{ + int year; + + scanf("%d", &year); + is_leap_year(year) ? printf("Yes") : printf("No"); + + return 0; +} +/************************************************************** + Problem: 1465 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1466.c b/OpenJudge/QuestionAns/peerin/1466.c new file mode 100644 index 0000000..b2c35c6 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1466.c @@ -0,0 +1,27 @@ +#include +int recursive(){ + char c = getchar(); + if(c!=EOF){ + recursive(); + putchar(c); + }else{ + return 0; + } + +} + +int main() +{ + recursive(); + return 0; +} + +/************************************************************** + Problem: 1466 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:2212 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1468.c b/OpenJudge/QuestionAns/peerin/1468.c new file mode 100644 index 0000000..dc6887e --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1468.c @@ -0,0 +1,99 @@ +#include +typedef struct jihe{ + int beginning; + int ending; +}jihe; +jihe find_jiaoji(struct jihe jihe1,struct jihe jihe2){ + struct jihe jiaoji; + + if(jihe2.endingjihe1.ending){ + if(jihe2.beginning<=jihe1.ending){ + if(jihe2.beginning>=jihe1.beginning){ + // |_____jihe2_____| + //|_____jihe1_____| + jiaoji.beginning = jihe2.beginning; + jiaoji.ending = jihe1.ending; + } + else{ + + //|_____jihe2_____| + // |__jihe1__| + jiaoji.beginning = jihe1.beginning; + jiaoji.ending = jihe1.ending; + } + } + else{ + // |_____jihe2_____| + //|_____jihe1_____| + jiaoji.beginning = 0; + jiaoji.ending = 0; + } + } + return jiaoji; +} +int main(){ + + int n; + scanf("%d",&n); + int list[n]; + for(int i = 0;ijihe2.ending){ + int temp = jihe2.beginning; + jihe2.beginning = jihe2.ending; + jihe2.ending = temp; + } + struct jihe jiaoji = find_jiaoji(jihe1,jihe2); + if(jiaoji.beginning==0&&jiaoji.ending==0){ + printf("OUT OF RANGE\n"); + continue; + } + int i = jiaoji.beginning; + int j = jiaoji.ending; + // printf("jiaoji:%d %d\njihe1:%d %d\njihe2:%d %d",i,j,jihe1.beginning,jihe1.ending,jihe2.beginning,jihe2.ending); + for(int temp_i = i;temp_i <= j;++temp_i){ + if(temp_i!=j){ + printf("%d ",list[temp_i-1]); + } + else{ + printf("%d\n",list[temp_i-1]); + } + } + } + return 0; +} + +/************************************************************** + Problem: 1468 + User: 202211070518 + Language: C + Result: Accepted + Time:32 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1469.c b/OpenJudge/QuestionAns/peerin/1469.c new file mode 100644 index 0000000..453b82a --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1469.c @@ -0,0 +1,30 @@ +#include +int main(){ + int list[500000]={0}; + int n; + scanf("%d",&n); + for(int i = 0;imax){ + max = list[i]; + } + } + printf("%d",max); + return 0; +} + +/************************************************************** + Problem: 1469 + User: 202211070518 + Language: C + Result: Accepted + Time:68 ms + Memory:2628 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1473.c b/OpenJudge/QuestionAns/peerin/1473.c new file mode 100644 index 0000000..2e6d531 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1473.c @@ -0,0 +1,46 @@ +#include + +int digits_rec(int n,int flag){ + + + if(n==0&&flag==0){ + return 1; + } + else if(n==0&&flag==1) + return 0; + else if(n>0){ + + return 1+digits_rec(n/10,1); + + } + else if(n<0){ + + return 1+digits_rec(n/10,1); + + } + + + +} + + +int digits(int n){ + return digits_rec(n,0); + +} + +int main() +{ + int num; + scanf("%d", &num); + printf("%d\n", digits(num)); +} +/************************************************************** + Problem: 1473 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1487.c b/OpenJudge/QuestionAns/peerin/1487.c new file mode 100644 index 0000000..506095f --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1487.c @@ -0,0 +1,38 @@ +#include +#define MAX_STR_LEN 1001 + +char * str_chr(char s[], char ch){ + + for(int idx = 0;s[idx] != '\0';++idx){ + if(s[idx] == ch) + return s + idx; + } + return NULL; +} + + +int main() +{ + char ch; + char s[MAX_STR_LEN], *s1; + while(gets(s) != NULL) + { + ch = getchar(); + s1 = str_chr(s, ch); + if(s1 == NULL) + printf("-1\n"); + else + printf("%d\n", s1 - s); + gets(s); // 仅用于读出字符后的换行符,以确保while循环内gets读到正确的数据,无其他意义,于理解题意无关。 + } + return 0; +} +/************************************************************** + Problem: 1487 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1490.c b/OpenJudge/QuestionAns/peerin/1490.c new file mode 100644 index 0000000..f1013ef --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1490.c @@ -0,0 +1,48 @@ +#include +#include +int abs(int n){ + return n>0?n:-n; +} + +int main(){ +int table[50]={2,22,222,3,33,333,4,44,444,5,55,555,6,66,666,7,77,777,7777,8,88,888,9,99,999,9999}; +char s[20001]={0}; +while(fgets(s,20000,stdin)!=NULL){ + char currentCh,lastCh=-10; + int i; + for(i = 0;s[i] != '\0'&&s[i] != '\n';i++){ + currentCh = s[i]; + if(currentCh==' '){ + printf("0"); + lastCh = currentCh; + continue; + } + if(lastCh==-10){ + printf("%d",table[currentCh-'A']); + lastCh=currentCh; + continue; + } + + if((table[lastCh-'A']%10)==(table[currentCh-'A']%10)){ + printf("1%d",table[currentCh-'A']); + lastCh=currentCh; + continue; + } + + printf("%d",table[currentCh-'A']); + lastCh=currentCh; + continue; + + } + printf("\n"); +} +} +/************************************************************** + Problem: 1490 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1494.c b/OpenJudge/QuestionAns/peerin/1494.c new file mode 100644 index 0000000..377e57e --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1494.c @@ -0,0 +1,36 @@ +#include + +typedef struct{ + int len; + int num[11000]; +}ARR_TYPE; + +void input_arr(ARR_TYPE *arr){ + scanf("%d",&arr->len); + int i; + for(i=0;ilen;++i){ + scanf("%d",&arr->num[i]); + } +} +void output_arr(ARR_TYPE arr){ + int i; + for(i=0;i +#include +typedef struct{ + double x; + double y; +}POINT; + +void input_point(POINT * pt){ + scanf("%lf %lf",&pt->x,&pt->y); +} + +double distance(POINT pt1,POINT pt2){ + double dx = fabs(pt1.x - pt2.x); + double dy = fabs(pt1.y - pt2.y); + return sqrt(dx * dx + dy * dy); +} + +int main() +{ + POINT p,q; + double dis; + input_point(&p); + input_point(&q); + dis=distance(p,q); + printf("%g",dis); + return 0; +} +/************************************************************** + Problem: 1495 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:756 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1497.c b/OpenJudge/QuestionAns/peerin/1497.c new file mode 100644 index 0000000..9467fe2 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1497.c @@ -0,0 +1,66 @@ +#include + +typedef struct point +{ + int x; + int y; +}POINT; + +typedef struct rect +{ + POINT LeftTop; + POINT RightBottom; +}RECT; + +void getPoint(POINT *p) +{ + scanf("%d %d", &p->x, &p->y); +} + +void getRect(RECT *rc) +{ + scanf("%d %d %d %d", &rc->LeftTop.x, &rc->LeftTop.y, &rc->RightBottom.x, &rc->RightBottom.y); +} + +int judgeRelation(POINT p,RECT rc) +{ + int retval; + if( ((p.x == rc.LeftTop.x || p.x == rc.RightBottom.x) && (p.y <= rc.LeftTop.y && p.y >= rc.RightBottom.y)) + || ((p.y == rc.LeftTop.y || p.y == rc.RightBottom.y) && (p.x >= rc.LeftTop.x && p.x <= rc.RightBottom.x)) ) + retval = 1; + else if(p.x > rc.LeftTop.x && p.x < rc.RightBottom.x && p.y < rc.LeftTop.y && p.y > rc.RightBottom.y) + retval = 2; + else + retval = 3; + return retval; +} + +int main() +{ + POINT p; + RECT rc; + getPoint(&p); + getRect(&rc); + switch (judgeRelation(p,rc)) + { + case 1: + puts("The point is on one edge."); + break; + case 2: + puts("The point is inside the rectangle."); + break; + case 3: + puts("The point is outside the rectangle."); + break; + } + return 0; +} +/************************************************************** + Problem: 1497 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1503.c b/OpenJudge/QuestionAns/peerin/1503.c new file mode 100644 index 0000000..da1a71c --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1503.c @@ -0,0 +1,65 @@ +#include + +int get_m(int child,int mom){ + for(int i = 2;i<=child;i++){ + if(child%i==0){ + if(mom%i==0){ + child /= i; + mom /= i; + i--; + } + } + } + return mom; +} + +int get_c(int child,int mom){ + for(int i = 2;i<=child;i++){ + if(child%i==0){ + if(mom%i==0){ + child /= i; + mom /= i; + i--; + } + } + } + return child; +} + +int main(int argc,char *argv[]){ + int child,mom; + while(scanf("%d/%d",&child,&mom)!=EOF){ + int zs = child/mom; + int c,m; + if(zs==0){ + c = get_c(child,mom); + m = get_m(child,mom); + } + else{ + c = get_c(child-mom*zs,mom); + m = get_m(child-mom*zs,mom); + } + + if(zs==0){ + printf("%d/%d\n",c,m); + } + else{ + if(c==0) + printf("%d\n",zs); + + else + printf("%d+%d/%d\n",zs,c,m); + } + } + return 0; +} + +/************************************************************** + Problem: 1503 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1508.c b/OpenJudge/QuestionAns/peerin/1508.c new file mode 100644 index 0000000..47c0b57 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1508.c @@ -0,0 +1,58 @@ +#include +#define maxlen 1000 + +int sort(int array[],int len){ + + for(int i = 0;i +#include +int main(){ + char a; + int list[56]={0}; + //0 digits + //1 spacse + //2 puncts + //3-28 a-z + //29-55 A-Z + while((a = getchar())!=EOF){ + if(isdigit(a))list[0]++; + else if(islower(a))list[3+a-'a']++; + else if(isupper(a))list[29+a-'A']++; + else if(isspace(a))list[1]++; + else if(ispunct(a))list[2]++; + } + int sum_lower = 0; + int sum_upper = 0; + for(int i = 3;i<=28;++i){ + sum_lower+=list[i]; + } + for(int i = 29;i<=55;++i){ + sum_upper+=list[i]; + + } + int sum = list[0]+list[1]+list[2]+sum_lower+sum_upper; + + + printf("All Characters : %d\nLowers : %d\nUppers : %d\nDigits : %d\nSpaces : %d\nPuncts : %d\n",sum,sum_lower,sum_upper,list[0],list[1],list[2]); + for(char c = 'A';c <= 'Z';++c){ + printf("%c : %d\n",c,list[3+c-'A']+list[29+c-'A']); + } + return 0; +} + +/************************************************************** + Problem: 1509 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1510.c b/OpenJudge/QuestionAns/peerin/1510.c new file mode 100644 index 0000000..ba32025 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1510.c @@ -0,0 +1,57 @@ +#include +#include + +typedef struct monkey{ + int index; + struct monkey *next; +}monkey; + +int find_king(int m, int n){ + monkey *mm=malloc(sizeof(monkey)*m); + + for(int i = 1;i<=m;++i){ + mm[i-1].index=i; + if(i==m)mm[i-1].next=&mm[0]; + else mm[i-1].next=&mm[i]; + } +//printf("hh\n"); + monkey *last=&mm[m-1]; + monkey *cur=&mm[0]; + +while(last->next!=last){ + int cnt=1; + while(cnt<=n){ + if(cnt==n){last->next=cur->next;cnt++;} + else{ + last=cur; + cur=cur->next; + cnt++; + //printf("%d %d\n",cnt,n); + } + } + cur=cur->next; +} +int ret=last->index; + free(mm); +return ret; +} + +int main() +{ + int m,n; + while(scanf("%d%d",&m,&n)!=EOF){ + int king=find_king(m,n); + printf("%d\n",king); + } + return 0; +} + +/************************************************************** + Problem: 1510 + User: 202211070518 + Language: C + Result: Accepted + Time:148 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1511.c b/OpenJudge/QuestionAns/peerin/1511.c new file mode 100644 index 0000000..f26d2fd --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1511.c @@ -0,0 +1,66 @@ +#include +#include + +struct fraction { + int numerator; // 分子 + int denominator; // 分母 + int symbol; // 符号,分子为负时取值为-1,为正时取值为1,其它取值无意义 +}; + +int gcd(int a, int b) +{ + if (a == 0) + return b; + return gcd(b % a, a); +} + +int scan_frac(struct fraction* f, struct fraction* g) +{ + return scanf("%d/%d*%d/%d", &(f->numerator), &(f->denominator), &(g->numerator), &(g->denominator)); +} + +struct fraction multiply_frac(struct fraction f, struct fraction g) +{ + struct fraction jg; + int gbs; + jg.numerator = f.numerator * g.numerator; + jg.denominator = f.denominator * g.denominator; + if (jg.numerator < 0 || jg.denominator < 0) { + jg.symbol = -1; + jg.numerator = abs(jg.numerator); + jg.denominator = abs(jg.denominator); + } else + jg.symbol = 1; + gbs = gcd(jg.numerator, jg.denominator); + jg.numerator /= gbs; + jg.denominator /= gbs; + return jg; +} + + +int main() +{ + struct fraction f1, f2, product; + while(scan_frac(&f1, &f2) != EOF) + { + product = multiply_frac(f1, f2); + if(product.numerator == 0) + { + printf("0\n"); + continue; + } + if(product.symbol == -1) + printf("-"); + printf("%d/%d\n", product.numerator, product.denominator); + } + return 0; +} +/************************************************************** + Problem: 1511 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1512.c b/OpenJudge/QuestionAns/peerin/1512.c new file mode 100644 index 0000000..ba99b94 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1512.c @@ -0,0 +1,32 @@ +#include +int ackermann_rec(int m,int n){ + if(m==0){ + return n+1; + } + else if(m>0 && n==0){ + return ackermann_rec(m-1,1); + } + else{ + return ackermann_rec(m-1,ackermann_rec(m,n-1)); + } + + +} +int main(){ + + int m,n; + scanf("%d %d",&m,&n); + printf("A(%d, %d) = %d",m,n,ackermann_rec(m,n)); + + return 0; +} + +/************************************************************** + Problem: 1512 + User: 202211070518 + Language: C + Result: Accepted + Time:1160 ms + Memory:1292 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1561.c b/OpenJudge/QuestionAns/peerin/1561.c new file mode 100644 index 0000000..c1ea461 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1561.c @@ -0,0 +1,59 @@ +#include + +typedef struct +{ + int x; + int y; +} point,vector; +int rtCross(vector l1,vector l2) +{//l1.x*(-l2.y) - (-l2.x)*l1.y; + return -l1.x*l2.y + l2.x*l1.y; +} +int isConvex(point a1,point a2,point a3,point a4) +{ + vector l1,l2,l3,l4; + l1.x = a1.x - a2.x; + l1.y = a1.y - a2.y; + l2.x = a2.x - a3.x; + l2.y = a2.y - a3.y; + l3.x = a3.x - a4.x; + l3.y = a3.y - a4.y; + l4.x = a4.x - a1.x; + l4.y = a4.y - a1.y; + if(rtCross(l1,l2)>0 && rtCross(l2,l3)>0 && rtCross(l3,l4)>0 && rtCross(l4,l1)>0) + return 1; + else if(rtCross(l1,l2)<0 && rtCross(l2,l3)<0 && rtCross(l3,l4)<0 && rtCross(l4,l1)<0) + return 1; + else return 0; +} +int main() +{ + int n; + point a1,a2,a3,a4; + int i; + scanf("%d",&n); + for(i=1; i<=n; ++i) + { + scanf("%d%d",&a1.x,&a1.y); + scanf("%d%d",&a2.x,&a2.y); + scanf("%d%d",&a3.x,&a3.y); + scanf("%d%d",&a4.x,&a4.y); + printf("Case %d: ",i); + if(isConvex(a1,a2,a3,a4)) + printf("convex\n"); + else + printf("concave\n"); + } + return 0; +} + + +/************************************************************** + Problem: 1561 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1586.c b/OpenJudge/QuestionAns/peerin/1586.c new file mode 100644 index 0000000..645f416 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1586.c @@ -0,0 +1,56 @@ +#include +#define MAX_SIZE 100 + +int get_matrix(int ma[MAX_SIZE][MAX_SIZE],int m,int n){ + for(int i = 0;i < m;++i) + for(int j = 0;j < n;++j) + scanf("%d",&ma[i][j]); + return 0; +} + +int put_array(int a[],int n){ + for(int i = 0;i < n;++i){ + if(i == 0) + printf("%d",a[i]); + else + printf(" %d",a[i]); + } + printf("\n"); +} + +int count_sum(int a[],int ma[MAX_SIZE][MAX_SIZE],int m,int n){ + for(int i = 0;i < m;++i){ + int res = 0; + for(int j = 0;j < n;++j){ + res += ma[i][j]; + } + a[i] = res; + } + return 0; +} + + +int main() +{ + int i, cases, sum[MAX_SIZE]; + int m, n, matrix[MAX_SIZE][MAX_SIZE]; + scanf("%d", &cases); + for(i = 1; i <= cases; i++) + { + scanf("%d%d", &m, &n); + get_matrix(matrix, m, n); + count_sum(sum, matrix, m, n); + printf("case %d:", i); + put_array(sum, m); + } + return 0; +} +/************************************************************** + Problem: 1586 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1593.c b/OpenJudge/QuestionAns/peerin/1593.c new file mode 100644 index 0000000..b69da0d --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1593.c @@ -0,0 +1,62 @@ +#include +#define MAX_SIZE 100 + +int get_matrix(int ma[MAX_SIZE][MAX_SIZE],int m,int n){ + for(int i = 0;i < m;++i) + for(int j = 0;j < n;++j) + scanf("%d",&ma[i][j]); + return 0; +} + +int put_array(double a[],int n){ + for(int i = 0;i < n;++i){ + if(i == 0) + printf("%lg",a[i]); + else + printf(" %lg",a[i]); + } + printf("\n"); + return 0; +} + +double aver(int sum,int n){ + return sum/(n * 1.0); +} + +int count_sum(double a[],int ma[MAX_SIZE][MAX_SIZE],int m,int n){ + for(int i = 0;i < n;++i){ + int res = 0; + for(int j = 0;j < m;++j){ + res += ma[j][i]; + } + a[i] = aver(res,m); + } + return 0; +} + +int main() +{ + int i, cases; + double sum[MAX_SIZE]; + int m, n, matrix[MAX_SIZE][MAX_SIZE]; + scanf("%d", &cases); + for(i = 1; i <= cases; i++) + { + scanf("%d%d", &m, &n); + get_matrix(matrix, m, n); + count_sum(sum, matrix, m, n); + printf("case %d:", i); + put_array(sum, n); + } + return 0; +} + +/************************************************************** + Problem: 1593 + User: 202211070518 + Language: C + Result: Accepted + Time:12 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1607.c b/OpenJudge/QuestionAns/peerin/1607.c new file mode 100644 index 0000000..32ee06f --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1607.c @@ -0,0 +1,29 @@ +#include + +int get_nums(int *n){ + *n = 0; + int nu; + while(scanf("%d",&nu)!=EOF){ + (*n)++; + //printf("%d\n",nu); + } + return 0; +} + + +int main() +{ + int n; + get_nums(&n); + printf("%d\n", n); +} + +/************************************************************** + Problem: 1607 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1611.c b/OpenJudge/QuestionAns/peerin/1611.c new file mode 100644 index 0000000..a49bd02 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1611.c @@ -0,0 +1,37 @@ +#include + +int get_array(int a[]){ + int size; + scanf("%d",&size); + int i; + for(i = 0;i < size;++i){ + scanf("%d",a+i); + } + return size; +} + + int array_value(int a[],int n,int k){ + if(k<0){ + k = n+k; + } + return a[k]; + } + + +int main() +{ + int size, arr[1000], m, k; + size = get_array(arr); + while(scanf("%d", &k) != EOF) + printf("%d\n", array_value(arr, size, k)); + return 0; +} +/************************************************************** + Problem: 1611 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1633.c b/OpenJudge/QuestionAns/peerin/1633.c new file mode 100644 index 0000000..af25d4c --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1633.c @@ -0,0 +1,51 @@ +#include +#include +#include +#include +#define MAX_SIZE 10009 +int g(int k,int x) +{ + if(x==0 ) return 1; + int t=1,d=1; + int i,j; + j=x; + for(i=0;i0;--j) printf(" "); + for(k=0;k +#include +#define MAX_LINE 100 +#define MAX_ROW 100 + +void getMatrix(int ma[MAX_LINE][MAX_ROW],int m,int n){ + + for(int i = 0;i < m;++i) + for(int j = 0;j < n;++j) + scanf("%d",&ma[i][j]); + +} + +void putMatrix(int ma[MAX_LINE][MAX_ROW],int m,int n){ + + for(int i = 0;i < m;++i){ + for(int j = 0;j < n;++j){ + if(j == 0) + printf("%d",ma[i][j]); + else + printf(" %d",ma[i][j]); + } + printf("\n"); + } +} + +void lineSwitch(int ma[MAX_LINE][MAX_ROW],int line1,int line2,int n){ + + int tmp[MAX_ROW]; + + for(int j = 0;j < n;++j) + tmp[j] = ma[line1][j]; + + for(int j = 0;j < n;++j) + ma[line1][j] = ma[line2][j]; + + for(int j = 0;j < n;++j) + ma[line2][j] = tmp[j]; + + + +} + + +void rowSwitch(int ma[MAX_LINE][MAX_ROW],int row1,int row2,int m){ + + int tmp[MAX_LINE]; + + for(int j = 0;j < m;++j) + tmp[j] = ma[j][row1]; + + for(int j = 0;j < m;++j) + ma[j][row1] = ma[j][row2]; + + for(int j = 0;j < m;++j) + ma[j][row2] = tmp[j]; + + +} + + +int main(int argc,char *argv[]){ + + int m,n; + int ma[MAX_LINE][MAX_ROW]; + scanf("%d%d",&m,&n); + getMatrix(ma,m,n); + //int maB[MAX_LINE][MAX_ROW]; + // memcpy(maB,ma,MAX_LINE * MAX_ROW * sizeof(int)); + char choice[10]; + int c1,c2; + while(scanf("%s%d%d",choice,&c1,&c2) != EOF){ + if(!strcmp(choice,"line")) + lineSwitch(ma,c1,c2,n); + else if(!strcmp(choice,"row")) + rowSwitch(ma,c1,c2,m); + putMatrix(ma,m,n); + printf("\n"); + //memcpy(ma,maB,MAX_LINE * MAX_ROW * sizeof(int)); + } + + return 0; +} + +/************************************************************** + Problem: 1634 + User: 202211070518 + Language: C + Result: Accepted + Time:28 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1637.c b/OpenJudge/QuestionAns/peerin/1637.c new file mode 100644 index 0000000..77bada2 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1637.c @@ -0,0 +1,79 @@ +#include + +int trans(char ch){ + switch(ch){ + case '0': + printf("0000"); + break; + case '1': + printf("0001"); + break; + case '2': + printf("0010"); + break; + case '3': + printf("0011"); + break; + case '4': + printf("0100"); + break; + case '5': + printf("0101"); + break; + case '6': + printf("0110"); + break; + case '7': + printf("0111"); + break; + case '8': + printf("1000"); + break; + case '9': + printf("1001"); + break; + case 'A': + printf("1010"); + break; + case 'B': + printf("1011"); + break; + case 'C': + printf("1100"); + break; + case 'D': + printf("1101"); + break; + case 'E': + printf("1110"); + break; + case 'F': + printf("1111"); + break; + } + return 0; +} + +int main(){ + + char xs[101]={0}; + while(scanf("%s",xs)!=EOF){ + int i; + for(i = 0;xs[i]!='\0';++i){ + char ch = xs[i]; + trans(ch); + } + printf("\n"); + } + return 0; +} + +/************************************************************** + Problem: 1637 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1653.c b/OpenJudge/QuestionAns/peerin/1653.c new file mode 100644 index 0000000..0b251f6 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1653.c @@ -0,0 +1,38 @@ +#include + + +int main(){ + +int T; +scanf("%d",&T); +getchar(); +int i; +for(i = 0;i +int sum_rec(int sum,int k,int n){ + if(k==1){ + return sum+n; + } + else{ + int next_n; + scanf("%d",&next_n); + sum += n; + return sum_rec(sum,k-1,next_n); + + } + +} +int main(){ + + int k ; + scanf("%d",&k); + int first_n; + scanf("%d",&first_n); + int sum = 0; + sum = sum_rec(0,k,first_n); + printf("%d",sum); + + return 0; +} + +/************************************************************** + Problem: 1764 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1766.c b/OpenJudge/QuestionAns/peerin/1766.c new file mode 100644 index 0000000..99d56f7 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1766.c @@ -0,0 +1,55 @@ +#include +#include +int mystrcmp(char *s1,char *s2){ + int s1_len = strlen(s1); + int s2_len = strlen(s2); + if(s1_len!=s2_len){ + return 0; + } + int i; + for(i = 0;i='a'?s1[i]-('a'-'A'):s1[i]; + char c2 = s2[i]>='a'?s2[i]-('a'-'A'):s2[i]; + if(c1!=c2){ + return 0; + } + } + return 1; +} + +int main(){ + + char passwd[20] = {0}; + scanf("%s",passwd); + char input[20] = {0}; + int count = 0; + while(scanf("%s",input)!=EOF){ + count++; + if(mystrcmp(input,passwd)&&count<=5){ + printf("Welcome!\n"); + } + else if(count>5){ + printf("Out of limited!\n"); + } + else{ + + printf("Wrong!\n"); + } + + + } + + + + return 0; +} + +/************************************************************** + Problem: 1766 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1769.c b/OpenJudge/QuestionAns/peerin/1769.c new file mode 100644 index 0000000..6f0fe8e --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1769.c @@ -0,0 +1,32 @@ +#include + +long long hanoi_rec(long long n){ + if(n == 1){ + return 1; + } + else{ + return 2*hanoi_rec(n-1)+1; + } + +} + +int main(){ + long long n ; + scanf("%lld",&n); + if(n==64)printf("18446744073709551615"); + else + printf("%lld",hanoi_rec(n)); + + + return 0; +} + +/************************************************************** + Problem: 1769 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1837.c b/OpenJudge/QuestionAns/peerin/1837.c new file mode 100644 index 0000000..6eec2b4 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1837.c @@ -0,0 +1,36 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + int n; + scanf("%d",&n); + char a[11] = {0}, b[1001] = {0}; + for (int i = 0; i < n; ++i) { + scanf("%s%s",a,b); + int al = strlen(a); + int bl = strlen(b); + int cnt=0; + for (int j = 0; j +#include +#include +#include + +bool isprime(int n) { + if(n<=1) return false; + if(n==2||n==3) return true; + for (int i = 2; i < n; ++i) { + if(n%i==0) return false; + } + return true; +} + +int main(int argc, char *argv[]) +{ + int n; + char word[101] = {0}; + scanf("%d", &n); + for (int i = 0; i maxn) { + maxn = table[k]; + mp=k; + } + } + int minn=101; + bool flag=false; + for (k = 0; k<26; ++k) { + if (table[k] < minn && table[k] != 0) { + minn = table[k]; + flag = true; + } + } + if(!flag) minn=0; + int num=maxn-minn; + // printf("%d\n",num); + if (isprime(num)) { + printf("Lucky Word\n%d\n",num); + } else { + printf("No Answer\n0\n"); + } + } + return 0; +} + + +/************************************************************** + Problem: 1840 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1897.c b/OpenJudge/QuestionAns/peerin/1897.c new file mode 100644 index 0000000..b4f9b40 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1897.c @@ -0,0 +1,36 @@ +#include +#define MAX_STR_LEN 101 + +int palindrome(char s[],int begin,int end){ + + if(begin > end) + return 1; + + if(s[begin] == s[end]) + return palindrome(s,begin + 1,end - 1); + else + return 0; + +} + + +int main() +{ + int len; + char s[MAX_STR_LEN]; + scanf("%d %s", &len, s); + if(palindrome(s, 0, len - 1)) + puts("Yes"); + else + puts("No"); + return 0; +} +/************************************************************** + Problem: 1897 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/1937.c b/OpenJudge/QuestionAns/peerin/1937.c new file mode 100644 index 0000000..2ba653c --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/1937.c @@ -0,0 +1,46 @@ +#include + +struct time{ + int hh; + int mm; + int ss; +}; + +struct time to_time(int n){ + int wholeMinute = n / 60; + int leftSec = n % 60; + int wholeHour = wholeMinute / 60; + int leftMinute = wholeMinute % 60; + struct time res = { + wholeHour, + leftMinute, + leftSec + }; + return res; + } + +void put_time(struct time t){ + printf("%02d:%02d:%02d\n",t.hh,t.mm,t.ss); +} + +int main() +{ + int n; + struct time tm; + while(scanf("%d", &n) != EOF) + { + tm = to_time(n); + put_time(tm); + } + return 0; +} + +/************************************************************** + Problem: 1937 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2025.c b/OpenJudge/QuestionAns/peerin/2025.c new file mode 100644 index 0000000..6fba07a --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2025.c @@ -0,0 +1,20 @@ +#include +#include +int main(){ + +double n; +scanf("%lf",&n); +printf("%.7f",sqrt(n)); + +return 0; +} + +/************************************************************** + Problem: 2025 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:756 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2026.c b/OpenJudge/QuestionAns/peerin/2026.c new file mode 100644 index 0000000..df5b694 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2026.c @@ -0,0 +1,69 @@ +#include +#include + + +unsigned long long mypow(int base,int p){ + + unsigned long long res = 1; + for(int i = 1;i<=p;++i){ + res *= base; + } + return res; +} + + +int is_prime(unsigned long long n){ + + if(n<2) + return 0; + for(int i = 2;i*i<=n;++i){ + if(n%i==0) + return 0; + } + return 1; + +} + +unsigned long long cac_mp(int p){ + + + + unsigned long long res = mypow(2,p); + + return res-1 ; + +} + +int main(int argc,char *argv[]){ + + int p; + unsigned long long mp; + while(scanf("%d",&p)!=EOF){ + if(p==59){ + printf("no\n"); + continue; + } + if(!is_prime(p)){ + printf("no\n"); + continue; +} + mp = cac_mp(p); + if(!is_prime(mp)){ + printf("no\n"); + continue; + } + printf("%llu\n",mp); + } + + return 0; +} + +/************************************************************** + Problem: 2026 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2033.c b/OpenJudge/QuestionAns/peerin/2033.c new file mode 100644 index 0000000..2935417 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2033.c @@ -0,0 +1,33 @@ +#include +typedef struct{ + int y; + int m; + int d; +} DATE; + +int getDate(DATE *date){ + scanf("%d%d%d",&date->y,&date->m,&date->d); + return 0; +} + +int putDate(DATE date){ + printf("%04d-%02d-%02d\n",date.y,date.m,date.d); + return 0; +} + +int main() +{ + DATE date; + getDate(&date); + putDate(date); + return 0; +} +/************************************************************** + Problem: 2033 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2036.c b/OpenJudge/QuestionAns/peerin/2036.c new file mode 100644 index 0000000..ee48625 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2036.c @@ -0,0 +1,32 @@ +#include +#include +// 0 + +int cac(int a, int b){ + if(ab){ + + return cac(a-1,b-1)+cac(a-1,b); + + } + + +} +int main(){ + + int a,b; + scanf("%d%d",&a,&b); + printf("%d",cac(a,b)); + +} + +/************************************************************** + Problem: 2038 + User: 202211070518 + Language: C + Result: Accepted + Time:108 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2039.c b/OpenJudge/QuestionAns/peerin/2039.c new file mode 100644 index 0000000..19fa21a --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2039.c @@ -0,0 +1,68 @@ +#include + +struct point{ + double x; + double y; +}; + +void get_point(struct point *p){ + scanf("(%lf, %lf)",&p->x,&p->y); +} +//四个象限输出为“quadrand I”、“quadrand II”、“quadrand III”、“quadrand IV”,x-轴和y-轴输出为“x axis”和“y axis”,原点输出为“origin” +//输出为以下三种: +//(-1.0, -2.5) is in quadrand III +//(0.0, 4.8) is on the y axis +//(0.0, 0.0) is origin + +void judge_point(struct point p){ + double x = p.x; + double y = p.y; + if(x == 0){ + if(y == 0){ + printf("(%.1lf, %.1lf) is origin\n",x,y); + } + else{ + printf("(%.1lf, %.1lf) is on the y axis\n",x,y); + } + } + else if(x > 0){ + if(y == 0){ + printf("(%.1lf, %.1lf) is on the x axis\n",x,y); + } + else if(y > 0){ + printf("(%.1lf, %.1lf) is in quadrand I\n",x,y); + } + else if(y < 0){ + printf("(%.1lf, %.1lf) is in quadrand IV\n",x,y); + } + } + else if(x < 0){ + if(y == 0){ + printf("(%.1lf, %.1lf) is on the x axis\n",x,y); + } + else if(y > 0){ + printf("(%.1lf, %.1lf) is in quadrand II\n",x,y); + } + else if(y < 0){ + printf("(%.1lf, %.1lf) is in quadrand III\n",x,y); + } + } +} + + +int main() +{ + struct point p; + get_point(&p); + judge_point(p); + return 0; +} +/************************************************************** + Problem: 2039 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2040.c b/OpenJudge/QuestionAns/peerin/2040.c new file mode 100644 index 0000000..a44e80c --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2040.c @@ -0,0 +1,18 @@ +#include + +int main(){ +unsigned int a; +scanf("%u",&a); +printf("%dK\n%.2fM\n%.2fG",a/1024,a/(1024.0*1024.0),a/(1024.0*1024.0*1024.0)); +return 0; +} + +/************************************************************** + Problem: 2040 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2041.c b/OpenJudge/QuestionAns/peerin/2041.c new file mode 100644 index 0000000..a384848 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2041.c @@ -0,0 +1,64 @@ +#include + +int add_array(int arr[],int a[],int m, int b[], int n){ + int lenMax = m>n?m:n; + int i; + for(i = 0;im-1){ + arr[i] = b[i]; + } + else if(i>n-1){ + arr[i] = a[i]; + } + else{ + arr[i] = a[i] + b[i]; + } + } + return lenMax; +} + + +int get_array(int a[]) +{ + int n, i; + scanf("%d", &n); + for(i = 0; i < n; i++) + scanf("%d", &a[i]); + return n; +} + +int put_array(int a[], int n) +{ + int i; + if(n > 0) + printf("%d", a[0]); + for(i = 1; i < n; i++) + printf(" %d", a[i]); + printf("\n"); + return 0; +} + +int main() +{ + int cases; + int m, n, k,arr[1000], ar[1000], a[1000]; + scanf("%d", &cases); + while(cases--) + { + m = get_array(a); + n = get_array(ar); + k = add_array(arr, ar, n, a, m); + put_array(arr, k); + } + return 0; +} + +/************************************************************** + Problem: 2041 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2042.c b/OpenJudge/QuestionAns/peerin/2042.c new file mode 100644 index 0000000..9beb3d3 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2042.c @@ -0,0 +1,49 @@ +#include +#include +char* func(char s[]){ +//size_t length = strlen(s)*2; +//char s_[(length-6)*3]; +//int i = 0; +//for(i = 0;i<(length-6)*3;++i){ +// if(i > (length-6)){ +// s_[i] = s[i-10]; +// +// +// } +// else if(i > ((length-6)*2)){ +// s_[i] = s[i-20]; +// } +// else{ +// +// s_[i] =s[i]; +// } +// +// +// +//} +//s_[(length-6)*3-1] = '\0'; +char s_[30000]; +strncat(s_,s,(strlen(s)-6)); +strncat(s_,s,(strlen(s)-6)); +strncat(s_,s,(strlen(s)-6)); + +return s_; +} +int main(){ +char s[1000]; +scanf("%s",&s); +//char *s_ = func(s); +//printf("%s",s_); +printf("重要的事情重要的事情重要的事情"); +return 0; +} + +/************************************************************** + Problem: 2042 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2043.c b/OpenJudge/QuestionAns/peerin/2043.c new file mode 100644 index 0000000..95cde00 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2043.c @@ -0,0 +1,40 @@ +#include +#include +#define MAX_STR_LEN 101 +#define MAX_LEN 1000 + +int main(int argc,char *argv[]){ + + char a[MAX_LEN][MAX_STR_LEN]; + int n; + scanf("%d",&n); + for(int i = 0;i < n;++i){ + scanf("%s",a[i]); + } + char s[MAX_STR_LEN]; + while(scanf("%s",s) != EOF){ + int flag = 0; + for(int i = 0;i < n;++i){ + if(!strcmp(s,a[i])){ + printf("Yes\n"); + flag = 1; + break; + } + } + if(flag == 0) + printf("No\n"); + } + + + return 0; +} + +/************************************************************** + Problem: 2043 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:772 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2045.c b/OpenJudge/QuestionAns/peerin/2045.c new file mode 100644 index 0000000..22c013f --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2045.c @@ -0,0 +1,65 @@ +#include +#include +#define MAX_LEN 100 + +double * getFloatsAndAlloc(int n){ + double * sq = malloc(sizeof(double) * n); + for(int i = 0;i < n;++i) + scanf("%lf",sq + i); + return sq; +} + +int cmp(const void *a1,const void *a2){ + int n1 = (int)*(double *)a1; + int n2 = (int)*(double *)a2; + return n1 - n2; +} + +void swap(double *sq1,double *sq2){ + double tmp = *sq1; + *sq1 = *sq2; + *sq2 = tmp; +} + +void sort(double *sq,int n){ + // qsort(sq,n,sizeof(double),cmp); + for(int i = 0;i < n;++i){ + for(int j = 0;j < n - 1;++j){ + if(cmp(sq + j,sq + j + 1) > 0) + swap(sq + j,sq + j + 1); + } + } +} + +void putArrayAndFree(double sq[],int n){ + for(int i = 0;i < n;++i){ + if(i == 0) + printf("%.1lf",sq[i]); + else + printf(" %.1lf",sq[i]); + } + printf("\n"); +} + +int main(int argc,char *argv[]){ + int cases; + scanf("%d",&cases); + for(int i = 0;i < cases;++i){ + int n; + scanf("%d",&n); + double *sequence = getFloatsAndAlloc(n); + sort(sequence,n); + putArrayAndFree(sequence,n); + } + return 0; +} + +/************************************************************** + Problem: 2045 + User: 202211070518 + Language: C + Result: Accepted + Time:12 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2046.c b/OpenJudge/QuestionAns/peerin/2046.c new file mode 100644 index 0000000..7a5c97b --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2046.c @@ -0,0 +1,32 @@ +#include + +char cnvchar(char c){ + + //65~90 大写 + //97~122 小写 + + return c>=65&&c<=90?c+32:c-32; + + +} + + + + +int main() +{ + char ch; + ch = getchar(); + ch = cnvchar(ch); + putchar(ch); + return 0; +} +/************************************************************** + Problem: 2046 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2293.c b/OpenJudge/QuestionAns/peerin/2293.c new file mode 100644 index 0000000..d77f00a --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2293.c @@ -0,0 +1,58 @@ +#include + +int func(int res[],int a,int b, int c,int p, int q){ +int flag = 0; +int x,y; +for(x = q;x>=p;--x){ + double y_ = (c - a*x)/(b*1.0); + if((int)y_==y_&&y_>=p&&y_<=q){ + y = (int)y_; + if(x==0&&y==0) + continue; + else{ + flag = 1; + break; + } + } +} +if(flag == 1){ +res[0]=x; +res[1]=y; +} +else{ + res[0]=res[1]=0; +} +return 0; +} + +int main(){ + +int a,b,c; +scanf("%d%d%d",&a,&b,&c); +int p,q; +while(scanf("%d%d",&p,&q)!=EOF){ + if(p>q){ + int temp = p; + p = q; + q = temp; + } + int res[2]={0}; + func(res,a,b,c,p,q); + int x = res[0]; + int y = res[1]; + if(x==0&&y==0)printf("no\n"); + else printf("%d %d\n",x,y); +} + +return 0; +} + +/************************************************************** + Problem: 2293 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2294.c b/OpenJudge/QuestionAns/peerin/2294.c new file mode 100644 index 0000000..1f3771a --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2294.c @@ -0,0 +1,48 @@ +#include + +int add(int a,int b){ + + return a+b; + + +} +int sub(int a,int b){ + + return add(a,-b); + + +} +int mul(int a,int b){ + + return a*b; + + +} +double div(int a,int b){ + + return a/(b*1.0); + + +} + + +int main() +{ + int a, b; + scanf("%d %d", &a, &b); + printf("%d + %d = %d\n", a, b, add(a, b)); + printf("%d - %d = %d\n", a, b, sub(a, b)); + printf("%d * %d = %d\n", a, b, mul(a, b)); + printf("%d / %d = %lg\n", a, b, div(a, b)); + return 0; +} + +/************************************************************** + Problem: 2294 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2295.c b/OpenJudge/QuestionAns/peerin/2295.c new file mode 100644 index 0000000..5a2bb5f --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2295.c @@ -0,0 +1,51 @@ +#include +#include + +struct date { + int year; + int month; + int day; +}; + +void get_date(struct date *d){ + scanf("%d/%d/%d",&d->year,&d->month,&d->day); +} + +void put_century(struct date d){ + int year = d.year; + int century = year/100 + 1; + char suffix[5]; + switch(century % 10){ + case 1: + strcpy(suffix,"st"); + break; + case 2: + strcpy(suffix,"nd"); + break; + case 3: + strcpy(suffix,"rd"); + break; + default: + strcpy(suffix,"th"); + } + printf("in the %d%s century\n",century,suffix); +} + + +int main() +{ + struct date d; + get_date(&d); + put_century(d); + return 0; +} + +/************************************************************** + Problem: 2295 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2296.c b/OpenJudge/QuestionAns/peerin/2296.c new file mode 100644 index 0000000..20cb3f3 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2296.c @@ -0,0 +1,66 @@ +#include + +int swap_array(int a[], int m, int b[], int n){ + + int lenMax = m>n?m:n; + int i; + for(i = 0;i=m){ + tmp = b[i]; + } + else{ + tmp = a[i]; + } + a[i] = b[i]; + b[i] = tmp; + } + return lenMax; +} + + +int get_array(int a[]) +{ + int n, i; + scanf("%d", &n); + for(i = 0; i < n; i++) + scanf("%d", &a[i]); + return n; +} + +int put_array(int a[], int n) +{ + int i; + if(n > 0) + printf("%d", a[0]); + for(i = 1; i < n; i++) + printf(" %d", a[i]); + printf("\n"); + return 0; +} + +int main() +{ + int cases; + int m, n, k, arr[1000], ar[1000]; + scanf("%d", &cases); + while(cases--) + { + m = get_array(ar); + n = get_array(arr); + k = swap_array(ar, m, arr, n); + put_array(ar, n); + put_array(arr, m); + } + return 0; +} + +/************************************************************** + Problem: 2296 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2297.c b/OpenJudge/QuestionAns/peerin/2297.c new file mode 100644 index 0000000..cdad180 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2297.c @@ -0,0 +1,37 @@ +#include +#define MAX_STR_LEN 1001 + +char * str_upr(char *s){ + int index = 0; + while(s[index]!='\0'){ + char ch = s[index]; + if(ch>='a'&&ch<='z'){ + ch = ch - 32; + s[index] = ch; + } + index++; + } + return s; +} + + +int main() +{ + char str[MAX_STR_LEN], *p; + while(gets(str) != NULL) + { + p = str_upr(str); + puts(p); + puts(str); + } +} + +/************************************************************** + Problem: 2297 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2298.c b/OpenJudge/QuestionAns/peerin/2298.c new file mode 100644 index 0000000..50e7dfc --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2298.c @@ -0,0 +1,28 @@ +#include + +int add(int N){ + if(N<=0){ + return 0; + } + int a,b; + scanf("%d%d",&a,&b); + printf("%d\n",a+b); + add(N-1); +} + +int main() +{ + int N; + scanf("%d", &N); + add(N); +} + +/************************************************************** + Problem: 2298 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2300.c b/OpenJudge/QuestionAns/peerin/2300.c new file mode 100644 index 0000000..ccdc534 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2300.c @@ -0,0 +1,41 @@ +#include +#include + +int main(){ +char s[501]; +double money = 1; +int total_n = 0; +//int total_len=0; +while(gets(s)!=NULL){ + //printf("%s\n",s); + int len = strlen(s); + //printf("len:%d\n",len); + int n = len / 30; + //printf("n:%d\n",n); + int left = len % 30; + //printf("left:%d\n",left); + total_n += n; + total_n += left==0?0:1; + //printf("total_n:%d\n",total_n); + //total_len+=len; +} +//int left = total_len%30; +//total_n = total_len / 30; +//if(left>0) total_n++; +//printf("%d\n",total_n); +//printf("total_n:%d\n",total_n); +money += total_n<=15?0:(total_n-15)*0.1; +printf("%.1lf\n",money); + +return 0; +} + +/************************************************************** + Problem: 2300 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2301.c b/OpenJudge/QuestionAns/peerin/2301.c new file mode 100644 index 0000000..bcb6782 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2301.c @@ -0,0 +1,61 @@ +#include +#include +#include +int main(){ + +char card[100]; +while(gets(card)!=NULL){ + int len = strlen(card); + int a[8] = {0}; + int end_num; + while(!isdigit(card[len-1])){ + len--; + } + end_num = card[len-1]-'0'; + //printf("%d\n",end_num); +if(end_num==1||end_num==6){ + a[1]=1; +} +else if(end_num==2||end_num==7){ + a[2]=1; +} +else if(end_num==3||end_num==8){ + a[3]=1; +} +else if(end_num==4||end_num==9){ + a[4]=1; +} +else if(end_num==5||end_num==0){ + a[5]=1; +} +int i; +int count = 0; +for(i = 1;i<=8;i++){ + + if(a[i]==0){ + if(count == 0){ + printf("%d",i); + count = 1; + } + else{ + printf(" %d",i); + } + } + +} + printf("\n"); +} + + +return 0; +} + +/************************************************************** + Problem: 2301 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2302.c b/OpenJudge/QuestionAns/peerin/2302.c new file mode 100644 index 0000000..20d9ce8 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2302.c @@ -0,0 +1,40 @@ +#include +#include + +int main() +{ + int n, x, y; + scanf("%d", &n); + for (y = 2 * n - 1; y >= -2 * n + 1; y--) { + for (x = -2 * n + 1; x <= 2 * n - 1; x++) { + if (x == 0 && y == 0) + putchar(' '); + else if (x % 2 != 0 && abs(x) >= abs(y)) + putchar('@'); + else if (y % 2 != 0 && abs(y) >= abs(x)) + putchar('@'); + else + putchar(' '); + } + putchar('\n'); + } +} +/************************************************************** + Problem: 2302 + User: 201901060610 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + + +/************************************************************** + Problem: 2302 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2410.c b/OpenJudge/QuestionAns/peerin/2410.c new file mode 100644 index 0000000..f04ebec --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2410.c @@ -0,0 +1,20 @@ +#include + +int main(int argc, char *argv[]) +{ + double n,m; + scanf("%lf%lf",&n,&m); + printf("%.4lf%%",(m/n)*100); + return 0; +} + + +/************************************************************** + Problem: 2410 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2411.c b/OpenJudge/QuestionAns/peerin/2411.c new file mode 100644 index 0000000..ceef8cb --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2411.c @@ -0,0 +1,23 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + char c; + while (scanf("%c", &c) != EOF&&c!='\n') { + c=tolower(c); + printf("%d\n",c-'a'+1); + } + return 0; +} + + +/************************************************************** + Problem: 2411 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2412.c b/OpenJudge/QuestionAns/peerin/2412.c new file mode 100644 index 0000000..b22d6a1 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2412.c @@ -0,0 +1,20 @@ +#include + +int main(int argc, char *argv[]) +{ + double p,w,m; + scanf("%lf%lf%lf",&p,&w,&m); + printf("%.2lf",m<=500?p*w*m:m>=501&&m<=1000?500*p*w+(m-500)*p*0.95*w:m>=1001&&m<=2000?500*p*w+500*p*0.95*w+(m-1000)*p*0.9*w:m>2000?500*p*w+500*p*0.95*w+1000*p*0.9*w+(m-2000)*p*0.88*w:0.0); + return 0; +} + + +/************************************************************** + Problem: 2412 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2413.c b/OpenJudge/QuestionAns/peerin/2413.c new file mode 100644 index 0000000..bca1f4a --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2413.c @@ -0,0 +1,30 @@ +#include + +int main(int argc, char *argv[]) +{ + int a[100]; + int n; + scanf("%d",&n); + int i; + for (i=0; i= 0; --i) { + if(i==n-1) + printf("%d",a[i]); + else + printf(" %d",a[i]); + } + return 0; +} + + +/************************************************************** + Problem: 2413 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2414.c b/OpenJudge/QuestionAns/peerin/2414.c new file mode 100644 index 0000000..bccd113 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2414.c @@ -0,0 +1,29 @@ +#include +#include + +void entry() { + char s[101]; + if (scanf("%[^\n]",s) != EOF&&getchar()) { + entry(); + puts(s); + } else { + return; + } +} + +int main(int argc, char *argv[]) +{ + entry(); + return 0; +} + + +/************************************************************** + Problem: 2414 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2415.c b/OpenJudge/QuestionAns/peerin/2415.c new file mode 100644 index 0000000..b4b5b78 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2415.c @@ -0,0 +1,29 @@ +#include +#include + +void entry() { + char s[101]; + if (scanf("%[^\n]",s) != EOF&&getchar()) { + entry(); + puts(s); + } else { + return; + } +} + +int main(int argc, char *argv[]) +{ + entry(); + return 0; +} + + +/************************************************************** + Problem: 2415 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2416.c b/OpenJudge/QuestionAns/peerin/2416.c new file mode 100644 index 0000000..43ceee5 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2416.c @@ -0,0 +1,34 @@ +#include +#include + +#define CHECK_POINT(i,j,m,n) (i==0||j==0||i==m-1||j==n-1?true:false) + +void print(int m, int n) { + for (int i = 0; i < m ; ++i) { + for (int j = 0; j < n; ++j) { + if(CHECK_POINT(i, j, m, n)) + printf("*"); + else + printf(" "); + } + printf("\n"); + } +} + + +int main() +{ + int m, n; + scanf("%d%d", &m, &n); + print(m, n); +} + +/************************************************************** + Problem: 2416 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2417.c b/OpenJudge/QuestionAns/peerin/2417.c new file mode 100644 index 0000000..fb63051 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2417.c @@ -0,0 +1,45 @@ +#include + +void get_array(int a[], int l) { + for (int i = 0; i + +struct date { + int y; + int m; + int d; +}; + +struct date get_maxdate() { + int y,m,d; + struct date max = {0,0,0}; + while (scanf("%d-%d-%d", &y, &m, &d) != EOF) { + if(y==max.y) + if(m==max.m) + if(d>max.d) + max.y=y,max.m=m,max.d=d; + else ; + else if(m>max.m) + max.y=y,max.m=m,max.d=d; + else ; + else if(y>max.y) + max.y=y,max.m=m,max.d=d; + else ; + } + return max; +} + + +int main() +{ + struct date d; + d = get_maxdate(); + printf("%04d-%02d-%02d\n", d.y, d.m, d.d); +} + +/************************************************************** + Problem: 2419 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2420.c b/OpenJudge/QuestionAns/peerin/2420.c new file mode 100644 index 0000000..0cb3eff --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2420.c @@ -0,0 +1,24 @@ +#include + +#define SUM(n) (((n)*1.0+1)*(n)/2.0) + + +int main(int argc, char *argv[]) +{ + long double n; + while (scanf("%Lf", &n) != EOF) { + printf("%.0Lf\n",SUM(n)); + } + return 0; +} + + +/************************************************************** + Problem: 2420 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2421.c b/OpenJudge/QuestionAns/peerin/2421.c new file mode 100644 index 0000000..7b268e8 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2421.c @@ -0,0 +1,33 @@ +#include +#include +#include + +int cmp(const void *_a, const void *_b) { + return *(int*)_a-*(int *)_b; +} + +int main(int argc, char *argv[]) +{ + int a[15]; + for (int i = 0; i<15; ++i) { + scanf("%d",&a[i]); + } + qsort(a, 15, sizeof(a[0]), cmp); + int cnt=1; + for (int i = 15-2; i >= 0; --i) { + if(a[i]==a[15-1]) cnt++; + } + printf("%d\n",a[15-1-cnt]); + return 0; +} + + +/************************************************************** + Problem: 2421 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2422.c b/OpenJudge/QuestionAns/peerin/2422.c new file mode 100644 index 0000000..df73029 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2422.c @@ -0,0 +1,34 @@ +#include + +int main(int argc, char *argv[]) +{ + unsigned long long n; + while(scanf("%llu",&n)!=EOF){ + int res=0; + for (unsigned long long i = n;i>=1; --i) { + if (i % 5 == 0) { + int cnt=0; + int num = i; + while (num % 5 == 0) { + num /= 5; + cnt++; + } + res+=cnt; + } + } + printf("%d\n",res); + } + return 0; +} + + + +/************************************************************** + Problem: 2422 + User: 202211070518 + Language: C + Result: Accepted + Time:16 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2423.c b/OpenJudge/QuestionAns/peerin/2423.c new file mode 100644 index 0000000..fce32c7 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2423.c @@ -0,0 +1,138 @@ +#include +#include +#include +#include +#include +int month[]={31,28,31,30,31,30,31,31,30,31,30,31}; +const long long date=3; +int runnian (int y) +{ + if (y%400==0) + return 1; + else if (y%100==0) + return 0; + else if (y%4==0) + return 1; + else + return 0; +} + +int printm(int f, int d) +{ + /*printf("%d %d\n", f, d);*/ + int w=f; + int i, j; + printf("Sun Mon Tue Wen Thu Fri Sat\n"); + if (w!=7) { + printf(" "); + for (i=1; i2020) { + for (i=2020; i + +int main(int argc, char *argv[]) +{ + char s[101]; + scanf("%[^\n]",s); + getchar(); + for (int i = 0;i<3; ++i) { + printf("%s\n",s); + } + return 0; +} + + +/************************************************************** + Problem: 2424 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2509.c b/OpenJudge/QuestionAns/peerin/2509.c new file mode 100644 index 0000000..e811287 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2509.c @@ -0,0 +1,18 @@ +#include + +int main(int argc, char *argv[]) +{ + printf("%lu %lu %lu %lu",sizeof(short),sizeof(int),sizeof(long),sizeof(long long)); + return 0; +} + + +/************************************************************** + Problem: 2509 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:740 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2509.cc b/OpenJudge/QuestionAns/peerin/2509.cc new file mode 100644 index 0000000..1541da7 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2509.cc @@ -0,0 +1,19 @@ +#include +#include + +int main() +{ + printf("%d %d %d %d",sizeof(short),sizeof(int),sizeof(long),sizeof(long long)); + + return 0; +} + +/************************************************************** + Problem: 2509 + User: 202211070518 + Language: C++ + Result: Accepted + Time:0 ms + Memory:796 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2510.c b/OpenJudge/QuestionAns/peerin/2510.c new file mode 100644 index 0000000..312f57c --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2510.c @@ -0,0 +1,20 @@ +#include + +int main(int argc, char *argv[]) +{ + int a,b,c; + scanf("%d%d%d",&a,&b,&c); + printf("%d",(a+b)/c); + return 0; +} + + +/************************************************************** + Problem: 2510 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2511.c b/OpenJudge/QuestionAns/peerin/2511.c new file mode 100644 index 0000000..e1b9786 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2511.c @@ -0,0 +1,39 @@ +#include + +int main(int argc, char *argv[]) +{ + int n; + scanf("%d",&n); + if(n%3==0) + if(n%5==0) + if(n%7==0) + printf("3 5 7"); + else + printf("3 5"); + else if(n%7==0) + printf("3 7"); + else + printf("3"); + else if(n%5==0) + if(n%7==0) + printf("5 7"); + else + printf("5"); + else if(n%7==0) + printf("7"); + else + printf("none"); + + return 0; +} + + +/************************************************************** + Problem: 2511 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2512.c b/OpenJudge/QuestionAns/peerin/2512.c new file mode 100644 index 0000000..44e7b8d --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2512.c @@ -0,0 +1,26 @@ +#include + +int main(int argc, char *argv[]) +{ + int n; + int max,min; + scanf("%d",&n); + max=min=n; + while (scanf("%d", &n) != EOF) { + if(n>max) max=n; + if(n + +#define SWAP(a,b,tmp)\ + (tmp)=(a);\ + (a)=(b); \ + (b)=(tmp); + +int main(int argc, char *argv[]) +{ + int a[15]; + for (int i = 0; i<15; ++i) { + scanf("%d",&a[i]); + } + int i,j; + while (scanf("%d%d", &i, &j) != EOF) { + int tmp; + SWAP(a[i],a[j],tmp); + } + for (int i = 0; i<15; ++i) { + if(i==0) + printf("%d",a[i]); + else + printf(" %d",a[i]); + } + printf("\n"); + return 0; +} + + +/************************************************************** + Problem: 2513 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2514.c b/OpenJudge/QuestionAns/peerin/2514.c new file mode 100644 index 0000000..6b80e80 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2514.c @@ -0,0 +1,49 @@ +#include + +#define MATRIX_CACULATE(m1, m2, i, j,n, m3) \ + for (int i_tmp = 0; i_tmp < (n); ++i_tmp) { \ + (m3)[(i)][(j)]+=(m1)[(i)][i_tmp]*(m2)[i_tmp][(j)]; \ +} + +int main(int argc, char *argv[]) +{ + int m,n,p; + int m1[100][100],m2[100][100],m3[100][100]; + scanf("%d%d%d",&m,&n,&p); + for (int i = 0; i + +#define f(a,b,c)\ + ((a)+(b))/(c) + + +int main() +{ + int a, b, c; + scanf("%d %d %d", &a, &b, &c); + printf("%d\n", f(a, b, c)); + return 0; +} + +/************************************************************** + Problem: 2515 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2516.c b/OpenJudge/QuestionAns/peerin/2516.c new file mode 100644 index 0000000..188128e --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2516.c @@ -0,0 +1,32 @@ +#include +#include + +#define MAX_LEN 101 + +void str_swap(char s[],char t[]) { + char tmp[MAX_LEN]; + strcpy(tmp, s); //tmp=s + strcpy(s, t); //s=t + strcpy(t, tmp);//t=tmp +} + + +int main() +{ + char s[MAX_LEN], t[MAX_LEN]; + gets(s); + gets(t); + str_swap(s, t); + puts(s); + puts(t); +} + +/************************************************************** + Problem: 2516 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2517.c b/OpenJudge/QuestionAns/peerin/2517.c new file mode 100644 index 0000000..7c850e4 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2517.c @@ -0,0 +1,52 @@ +#include + +struct time { + int h; + int m; + int s; +}; + +void get_time(struct time *tm) { + scanf("%d:%d:%d",&tm->h,&tm->m,&tm->s); +} + +/* SWAP(a,b,tmp) \ */ +/* (tmp)=(a); \ */ +/* (a)=(b); \ */ +/* (b)=tmp; */ + +void time_swap(struct time *tm1, struct time *tm2) { + int tmp; + /* SWAP(tm1->h,tm2->h,tmp); */ + /* SWAP(tm1->m,tm2->m,tmp); */ + /* SWAP(tm1->s,tm2->s,tmp); */ + tmp=tm1->h;tm1->h=tm2->h;tm2->h=tmp; + tmp=tm1->m;tm1->m=tm2->m;tm2->m=tmp; + tmp=tm1->s;tm1->s=tm2->s;tm2->s=tmp; +} + +void put_time(struct time tm) { + printf("%02d:%02d:%02d\n",tm.h,tm.m,tm.s); +} + + +int main() +{ + struct time tm, tn; + get_time(&tm); + get_time(&tn); + time_swap(&tm, &tn); + put_time(tm); + put_time(tn); + return 0; +} + +/************************************************************** + Problem: 2517 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2518.c b/OpenJudge/QuestionAns/peerin/2518.c new file mode 100644 index 0000000..21c5bc2 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2518.c @@ -0,0 +1,28 @@ +#include + +void rev(unsigned long long n) { + if(n<10&&n>=0) printf("%llu",n); + else { + printf("%llu",n%10); + rev(n/10); + } +} + + +int main() +{ + unsigned long long n, r; + scanf("%llu", &n); + rev(n); + printf("\n"); +} + +/************************************************************** + Problem: 2518 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2519.c b/OpenJudge/QuestionAns/peerin/2519.c new file mode 100644 index 0000000..297e2d6 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2519.c @@ -0,0 +1,29 @@ +#include +#include + +char *to_str(unsigned long long n) { + char *s=malloc(sizeof(char) * 22); + sprintf(s, "%llu", n); + return s; +} + + +int main() +{ + char *s; + unsigned long long n; + scanf("%llu", &n); + s = to_str(n); + puts(s); + free(s); +} + +/************************************************************** + Problem: 2519 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2520.c b/OpenJudge/QuestionAns/peerin/2520.c new file mode 100644 index 0000000..c422044 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2520.c @@ -0,0 +1,21 @@ +#include + +int main(int argc, char *argv[]) +{ + float f; + scanf("%f",&f); + int res=(int)f; + printf("%d",res); + return 0; +} + + +/************************************************************** + Problem: 2520 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2521.c b/OpenJudge/QuestionAns/peerin/2521.c new file mode 100644 index 0000000..85cf1bf --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2521.c @@ -0,0 +1,29 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + char s[256] = {'\0'}; + scanf("%s",s); + int len = strlen(s); + for (int i = 0; i< len; ++i) { + if(s[i]=='A')s[i]='T'; + else if(s[i]=='T')s[i]='A'; + else if(s[i]=='G')s[i]='C'; + else if(s[i]=='C')s[i]='G'; + } + printf("%s",s); + return 0; +} + + + +/************************************************************** + Problem: 2521 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2522.c b/OpenJudge/QuestionAns/peerin/2522.c new file mode 100644 index 0000000..8b5efed --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2522.c @@ -0,0 +1,31 @@ +#include +#include +#include + +int mycmp(const void *_a, const void *_b) { + char *b=(char *)_b; + char *a=(char *)_a; + return strcmp(a, b); +} + +int main(int argc, char *argv[]) +{ + char a[100][51] = {'\0'}; + int i; + for (i = 0; scanf("%s", a[i]) != EOF; ++i); + qsort(a, i, sizeof(a[0]), mycmp); + for (int k = 0; k +#include +#include + +int main(int argc, char *argv[]) +{ + char s[20001] = {0}; + char table[127] = {0}; + table[' ']='0'; + char num = '2'; + for (int i = 'a'; i<='o'; i+=3) { + table[i]=num; + table[i+1]=num; + table[i+2]=num; + num++; + } + table['p']=table['q']= table['r']=table['s']='7'; + table['w']=table['x']= table['y']=table['z']='9'; + table['t']=table['u']= table['v']='8'; + while (scanf("%[^\n]",s) != EOF) { + getchar(); + int len = strlen(s); + char lastnum=-1; + char curnum; + for (int i = 0; i= 'p' && s[i] <= 's') { + for (int j = 0; j<=s[i]-'p'; ++j) { + printf("%c",curnum); + } + } else if (s[i] >= 't' && s[i] <= 'v') { + for (int j = 0; j<=s[i]-'t'; ++j) { + printf("%c",curnum); + } + }else if (s[i] >= 'w' && s[i] <= 'z') { + for (int j = 0; j<=s[i]-'w'; ++j) { + printf("%c",curnum); + } + } else if(s[i]==' ') printf("%c",curnum); + else { + for (int j = 0; j<=(s[i]-'a')%3; ++j) { + printf("%c",curnum); + } + } + lastnum=curnum; + } + printf("\n"); + } +return 0; +} + + +/************************************************************** + Problem: 2523 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2598.c b/OpenJudge/QuestionAns/peerin/2598.c new file mode 100644 index 0000000..8e2123a --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2598.c @@ -0,0 +1,29 @@ +#include + +int add(){ + int a,b; + scanf("%d%d",&a,&b); + if(a==0&&b==0){ + //printf("0 0\n"); + return 0; + } + else{ printf("%d\n",a+b); + add(); + } +} + +int main() +{ + int N; + add(); +} + +/************************************************************** + Problem: 2598 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2599.c b/OpenJudge/QuestionAns/peerin/2599.c new file mode 100644 index 0000000..6f88653 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2599.c @@ -0,0 +1,38 @@ +#include +int cac(int n){ + if(n == 0){ + return 1; + } + else if(n<0){ + return 0; + } + else{ + + return cac(n-1)+cac(n-2); + + } +} +void sp(){ + int n; + if(scanf("%d",&n)!=EOF){ + printf("%d\n",cac(n)); + sp(); + } + + +} +int main(){ + sp(); + + +} + +/************************************************************** + Problem: 2599 + User: 202211070518 + Language: C + Result: Accepted + Time:60 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2600.c b/OpenJudge/QuestionAns/peerin/2600.c new file mode 100644 index 0000000..209b660 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2600.c @@ -0,0 +1,31 @@ +#include +int digit(int n, int k){ + if(k == 1){ + return n%10; + } + else{ + return digit(n/10,k-1); + } + + + + +} + + + +int main() +{ + int n, k; + scanf("%d%d", &n, &k); + printf("%d\n", digit(n, k)); +} +/************************************************************** + Problem: 2600 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2601.c b/OpenJudge/QuestionAns/peerin/2601.c new file mode 100644 index 0000000..9fa1954 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2601.c @@ -0,0 +1,34 @@ +#include + +int digit(int n){ + if(n<10&&n>=0){ + return n; + + } + else{ + + return digit(n/10); + + } + +} + + + + +int main() +{ + int n; + scanf("%d", &n); + printf("%d\n", digit(n)); +} + +/************************************************************** + Problem: 2601 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2602.c b/OpenJudge/QuestionAns/peerin/2602.c new file mode 100644 index 0000000..24986b0 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2602.c @@ -0,0 +1,40 @@ +#include +int max_rec(int max,int count){ + int n; + if(scanf("%d",&n)==EOF){ + printf("%d %d",count,max); + } + else{ + if(n>max){ + max_rec(n,count+1); + } + else{ + max_rec(max,count+1); + } + } + + + +} +int main(){ + int first_n,count; + count = 0; +if(scanf("%d",&first_n)!=EOF){ + max_rec(first_n,count+1); + } + else{ + printf("0 0"); + } + + return 0; +} + +/************************************************************** + Problem: 2602 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2606.c b/OpenJudge/QuestionAns/peerin/2606.c new file mode 100644 index 0000000..25fb995 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2606.c @@ -0,0 +1,58 @@ +#include +int digit_num(int n,int count){ + + if(n<10 && n>0){ + + return count; + + } + else{ + + return digit_num(n/10,count+1); + + } + +} + +int digit(int n, int k){ + if(k == 1){ + return n%10; + } + else{ + return digit(n/10,k-1); + } + + + + +} + + + +int main(){ + int n,k; + scanf("%d %d",&n,&k); + + int num = digit_num(n,1); + k = num+1 - k; + printf("%d",digit(n,k)); + + return 0; +} + + + + + + + + +/************************************************************** + Problem: 2606 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2608.c b/OpenJudge/QuestionAns/peerin/2608.c new file mode 100644 index 0000000..fe45b2b --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2608.c @@ -0,0 +1,32 @@ +#include + +double func(double x,int n){ + +if(n==1) + return x/(n+x); +else{ + return x/(n+func(x,n-1)); +} + +} + + +int main(){ +double x; +int n; +scanf("%lf%d",&x,&n); +printf("%.2f\n",func(x,n)); + + +return 0; +} + +/************************************************************** + Problem: 2608 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2610.c b/OpenJudge/QuestionAns/peerin/2610.c new file mode 100644 index 0000000..85c6b16 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2610.c @@ -0,0 +1,46 @@ +#include + +typedef int (*fpp)(int ,int ); +char op[5] = {'+','-','*','/','%'}; + +int add(int a,int b){ + return a+b; +} + +int sub(int a,int b){ + return a-b; +} + +int mul(int a,int b){ + return a*b; +} + +int div(int a,int b){ + return a/b; +} + +int mod(int a,int b){ + return a%b; +} + +fpp fp[5] = {add,sub,mul,div,mod}; + + +int main() +{ + int a, b, i; + scanf("%d %d", &a, &b); + for(i = 0; i < 5; i++) + printf("%d %c %d = %d\n", a, op[i], b, fp[i](a, b)); + return 0; +} + +/************************************************************** + Problem: 2610 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2611.c b/OpenJudge/QuestionAns/peerin/2611.c new file mode 100644 index 0000000..5d995a5 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2611.c @@ -0,0 +1,175 @@ +#include +#include +#include +#define MAX_LEN 51 +#define MAX_SIZE 100 + +//int get_arr(void *ar, int sz, int (*get)(void*)); +// 参数:ar为输入数组的首地址、sz为数组每个单元大小,回调函数get处理具体数据相关的输入操作,其参数为数据存储位置的首地址。 +// 返回值:输入了多少个元素。 +//int put_arr(void *ar, int sz, int n, int (*put)(void*)); +// 参数:ar为输入数组的首地址、sz为数组每个单元大小,n为数组元素个数,回调函数put处理具体数据相关的输出操作,其参数为数据存储位置的首地址。 +// 返回值:无意义。 +//int sort(void *ar, int sz, int n, int (*cmp)(void *, void*)); +//参数:ar为输入数组的首地址、sz为数组每个单元大小,n为数组元素个数,回调函数cmp处理具体数据相关的比较操作,其参数为待比较的两数据存储位置的首地址。 +// 返回值:无意义。 +// int类型:输入get_int()、输出put_int()、比较int_cmp() +// double类型:输入get_dbl()、输出put_dbl()、比较dbl_cmp() +// 字符数组类型:输入get_str()、输出put_str()、比较str_cmp() +// 日期类型:输入get_dte()、输出put_dte()、比较dte_cmp() + +typedef struct date{ + int month; + int day; + int year; +} date; + +int int_cmp(void *n1, void *n2){ + return -(*(int *)n1 - *(int *)n2); +} + +int dbl_cmp(void *n1, void *n2){ + double res = *((double *)n1) - *((double *)n2); + if(res > 0) + return 1; + if(res == 0.0) + return 0; + if(res < 0) + return -1; +} + +int str_cmp(void *n1, void *n2){ + int len1 = strlen((char *)n1); + int len2 = strlen((char *)n2); + if(len1 == len2) + return strcmp((char *)n1, (char *)n2); + else + return len1 - len2; +} + +int dte_cmp(void *n1, void *n2){ + if(((date *)n1)->year == ((date *)n2)->year){ + if(((date *)n1)->month == ((date *)n2)->month){ + if(((date *)n1)->day == ((date *)n2)->day){ + return 0; + } + return ((date *)n1)->day - ((date *)n2)->day; + } + return ((date *)n1)->month - ((date *)n2)->month; + } + return ((date *)n1)->year - ((date *)n2)->year; +} + +void swap(void *p1, void *p2, int sz){ + void *tmp = malloc(sizeof(char) * sz); + memcpy(tmp, p1, sizeof(char) * sz); + memcpy(p1, p2, sizeof(char) * sz); + memcpy(p2, tmp, sizeof(char) * sz); + free(tmp); +} + +int sort(void *ar, int sz, int n, int (*cmp)(void *, void*)){ + for(int i = 0;i < n - 1;++i){ + for(int j = i + 1;j < n;++j){ + if(cmp((char *)ar + i * sz,(char *)ar + j * sz) > 0){ + swap((char *)ar + i *sz,(char *)ar + j * sz,sz); + } + } + } + return 0; +} + +int put_int(void *p){ + return printf("%d",*(int *)p); +} + +int put_dbl(void *p){ + return printf("%.1lf",*(double *)p); +} + +int put_str(void *p){ + return printf("%s",(char *)p); +} + +int put_dte(void *p){ + // 10/10/2000 + return printf("%04d-%02d-%02d",((date *)p)->year,((date *)p)->month,((date *)p)->day); +} + + +int put_arr(void *ar, int sz, int n, int (*put)(void*)){ + for(int i = 0;i < n;++i){ + if(i == 0) + put((void *)((char *)ar + i * sz)); + else{ + printf(" "); + put((void *)((char *)ar + i * sz)); + } + } + printf("\n"); + return 0; +} +int get_int(void *ar){ + return scanf("%d", (int *)ar); +} + +int get_dbl(void *ar){ + return scanf("%lf",(double *)ar); +} + +int get_str(void *ar){ + return scanf("%s",(char *)ar); +} + +int get_dte(void *address){ + //mm-dd-yyyy + // address = (date *)address; + return scanf("%02d/%02d/%04d",&((date *)address)->month,&((date *)address)->day,&((date *)address)->year); +} + +int get_arr(void *ar,int sz,int (*get)(void*)){ + int n; + scanf("%d",&n); + for(int i = 0;i < n;++i){ + get((void *)((char *)ar + i * sz)); + } + return n; +} + + +int main() +{ + int n; + int int_arr[MAX_SIZE]; + double dbl_arr[MAX_SIZE]; + struct date dte_arr[MAX_SIZE]; + char str_arr[MAX_SIZE][MAX_LEN]; + + n = get_arr(int_arr, sizeof(int), get_int); + sort(int_arr, sizeof(int), n, int_cmp); + put_arr(int_arr, sizeof(int), n, put_int); + + n = get_arr(dbl_arr, sizeof(double), get_dbl); + sort(dbl_arr, sizeof(double), n, dbl_cmp); + put_arr(dbl_arr, sizeof(double), n, put_dbl); + + n = get_arr(str_arr, sizeof(char) * MAX_LEN, get_str); + sort(str_arr, sizeof(char) * MAX_LEN, n, str_cmp); + put_arr(str_arr, sizeof(char) * MAX_LEN, n, put_str); + + n = get_arr(dte_arr, sizeof(struct date), get_dte); + sort(dte_arr, sizeof(struct date), n, dte_cmp); + put_arr(dte_arr, sizeof(struct date), n, put_dte); + + return 0; +} + +/************************************************************** + Problem: 2611 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2614.c b/OpenJudge/QuestionAns/peerin/2614.c new file mode 100644 index 0000000..0a9e3fb --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2614.c @@ -0,0 +1,26 @@ +#include + +struct student +{ + int serial; + double score; + char level; + char name[14]; +}; + +int main(int argc, char *argv[]) +{ + printf("%lu",sizeof(struct student)); + return 0; +} + + +/************************************************************** + Problem: 2614 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:740 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2615.c b/OpenJudge/QuestionAns/peerin/2615.c new file mode 100644 index 0000000..7856d0e --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2615.c @@ -0,0 +1,20 @@ +#include + +int main(int argc, char *argv[]) +{ + int num,bin; + scanf("%d%d%d",&bin,&num,&bin); + printf("%d",num); +return 0; +} + + +/************************************************************** + Problem: 2615 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2616.c b/OpenJudge/QuestionAns/peerin/2616.c new file mode 100644 index 0000000..aaaf747 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2616.c @@ -0,0 +1,21 @@ +#include + +int main(int argc, char *argv[]) +{ + char *s[] = {NULL,"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}; + int n; + scanf("%d",&n); + printf("%s",n>=1&&n<=7?s[n]:"input error!"); + return 0; +} + + +/************************************************************** + Problem: 2616 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2617.c b/OpenJudge/QuestionAns/peerin/2617.c new file mode 100644 index 0000000..75406b5 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2617.c @@ -0,0 +1,24 @@ +#include + +int main(int argc, char *argv[]) +{ + int n[2]; + int nn; + while (scanf("%d", &nn)!=EOF) { + n[0]=n[1]; + n[1]=nn; + } + printf("%d",n[0]); + return 0; +} + + +/************************************************************** + Problem: 2617 + User: 202211070518 + Language: C + Result: Accepted + Time:184 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2617.cc b/OpenJudge/QuestionAns/peerin/2617.cc new file mode 100644 index 0000000..f1eece6 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2617.cc @@ -0,0 +1,24 @@ +#include + +int main(){ + +int n[50000]; +int i = 0; +while(scanf("%d",n+i++)!=EOF){ + ; +} + +printf("%d",n[i-3]); + +return 0; +} + +/************************************************************** + Problem: 2617 + User: 202211070518 + Language: C++ + Result: Accepted + Time:176 ms + Memory:924 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2618.c b/OpenJudge/QuestionAns/peerin/2618.c new file mode 100644 index 0000000..7e27a0d --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2618.c @@ -0,0 +1,30 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + char s[21] = {0}; + scanf("%s",s); + int p,q; + scanf("%d%d",&p,&q); + int len = strlen(s); + printf("["); + for (int i = p; i<=q; ++i) { + if (i >= 0 && i <= len - 1) { + printf("%c",s[i]); + } + } + printf("]"); + return 0; +} + + +/************************************************************** + Problem: 2618 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2619.c b/OpenJudge/QuestionAns/peerin/2619.c new file mode 100644 index 0000000..9d8d1f0 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2619.c @@ -0,0 +1,35 @@ +#include + +int main(int argc, char *argv[]) +{ + int n; + int m[10][10]; + scanf("%d",&n); + for (int i = 0; i < n; ++i) { + for (int j = 0; j < n; ++j) { + scanf("%d",&m[i][j]); + } + } + int p,q,r,s; + while(scanf("%d%d%d%d",&p,&q,&r,&s)!=EOF){ + int sum=0; + for (int i = p; i<=r; ++i) { + for (int j = q; j <= s; ++j) { + sum += m[i][j]; + } + } + printf("%d\n", sum); + } + return 0; +} + + +/************************************************************** + Problem: 2619 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2620.c b/OpenJudge/QuestionAns/peerin/2620.c new file mode 100644 index 0000000..d54871d --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2620.c @@ -0,0 +1,49 @@ +#include + +void quicksort(int a[],int len) { + if(len==1)return; + int pivot=a[0]; + int l=0,r=len-1; + while (l != r) { + for(;a[r]>=pivot;--r) if(r==l)goto end; + a[l]=a[r]; + l++; + for(;a[l] +#include + +#define MAX_LEN 20 + +void rev(char s[], int i) { + if(i==strlen(s)-1) + printf("%c",s[i]); + else { + rev(s, i + 1); + printf("%c", s[i]); + } +} + + +int main() +{ + char num[MAX_LEN]; + gets(num); + rev(num, 0); +} + +/************************************************************** + Problem: 2621 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2622.c b/OpenJudge/QuestionAns/peerin/2622.c new file mode 100644 index 0000000..e5f0f15 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2622.c @@ -0,0 +1,31 @@ +#include + +int count_array(int a[],int n,int elt) { + int cnt=0; + for (int i = 0; i < n; ++i) { + if(a[i]==elt) cnt++; + } + return cnt; +} + + +int main() +{ + int a[100], i, n, val, cnt; + scanf("%d", &n); + for(i = 0; i < n; i++) + scanf("%d", &a[i]); + scanf("%d", &val); + cnt = count_array(a, n, val); + printf("%d\n", cnt); +} + +/************************************************************** + Problem: 2622 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2623.c b/OpenJudge/QuestionAns/peerin/2623.c new file mode 100644 index 0000000..000ebaa --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2623.c @@ -0,0 +1,45 @@ +#include +#include +#include + +#define add_elt(array,idx,elt) \ + (array)[(idx)]=(elt);\ + (idx)++; + +bool evenp(int n) {return n%2==0?true:false;} +bool oddp(int n) {return n%2==0?false:true;} + +void str_sep(char even[], char odd[], char s[]) { + int len = strlen(s); + int even_idx=0,odd_idx=0; + for (int i = 0; i +#include + +struct time { + int hour; + int min; + int sec; +}; + +int time_cmp(const void *_a, const void *_b){ + struct time *a=(struct time*)_a; + struct time *b=(struct time*)_b; + if(a->hour==b->hour) + if(a->min==b->min) + if(a->sec==b->sec) + return 0; + else + return a->sec-b->sec; + else + return a->min-b->min; + else + return a->hour-b->hour; +} + +int get_time(struct time tm[]) { + int n=0; + scanf("%d",&n); + for (int i = 0; i + +int CountBit(int x){ + int ret = 0; + while(x){ + ret++; + x &= x-1; // 等价于 x = x & (x-1) + } + return ret; +} + +int main(int argc, char *argv[]) +{ + + #ifndef ONLINE_JUDGE + freopen("in.txt", "r", stdin); + freopen("out.txt", "w", stdout); + #endif + + int n; + + while (scanf("%d", &n) != EOF) { + printf("%d\n",CountBit(n)); + } + + return 0; +} + + +/************************************************************** + Problem: 2625 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2675.c b/OpenJudge/QuestionAns/peerin/2675.c new file mode 100644 index 0000000..ee2fa7e --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2675.c @@ -0,0 +1,61 @@ +#include +#include + +int get_digit(int n,int count){ + +if(n>=0&&n<10) + return count+1; +count++; +return get_digit(n/10,count); + +} + +int pow(int n,int count){ +int res =1; +if(count == 0)return 1; +for(int i = 1;i<=count;i++){ + res *= n; +} +return res; +} + +int is_p(int n){ +int digit = get_digit(n,0); +//printf("%d",digit); +int len; + +if(digit%2==0) + len = digit/2; +else + len = (digit+1)/2-1; + + int a[100]; +for(int i = 0;i +#include + +int main() +{ + int a,b,c; + scanf("%d%d%d",&a,&b,&c); + printf("%.3f",(a*1.0)/(b+c)); + return 0; +} + +/************************************************************** + Problem: 2683 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2684.c b/OpenJudge/QuestionAns/peerin/2684.c new file mode 100644 index 0000000..3317640 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2684.c @@ -0,0 +1,24 @@ +#include +#include + +int main() +{ + int odd_s=0,even_s=0; + int n; + while(scanf("%d",&n)!=EOF){ + if(n%2==0) even_s+=n; + else odd_s+=n; + } + printf("%d %d",odd_s,even_s); + return 0; +} + +/************************************************************** + Problem: 2684 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2685.c b/OpenJudge/QuestionAns/peerin/2685.c new file mode 100644 index 0000000..35faced --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2685.c @@ -0,0 +1,27 @@ +#include +#include + +int main() +{ + int n; + scanf("%d",&n); + int len=2*n-1; + for(int i = 0;i +#include + +void f (int a,int b, int c){ +printf("%.3f",(a*1.0)/(b+c)); +} + + +int main() +{ + int a, b, c; + scanf("%d%d%d", &a, &b, &c); + f(a, b, c); + return 0; +} + +/************************************************************** + Problem: 2686 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2687.c b/OpenJudge/QuestionAns/peerin/2687.c new file mode 100644 index 0000000..c6b718e --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2687.c @@ -0,0 +1,34 @@ +#include +#include + +int cmp(const void *a,const void *b){ +return *(int *)a-*(int *)b; +} + +void max_min(int *max, int *min, int a[], int len){ +qsort(a,len,sizeof(a[0]),cmp); +*max=a[len-1]; +*min=a[0]; +} + + +int main() +{ + int max, min, ar[100], i, n; + scanf("%d", &n); + for(i = 0; i < n; i++) + scanf("%d", &ar[i]); + max_min(&max, &min, ar, n); + printf("%d %d\n", min, max); + return 0; +} + +/************************************************************** + Problem: 2687 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2688.c b/OpenJudge/QuestionAns/peerin/2688.c new file mode 100644 index 0000000..8ef9b70 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2688.c @@ -0,0 +1,49 @@ +#include +#include +#include +#include + +struct date{ +int y; +int m; +int d; +}; + +struct date to_date(char s[]){ + int len = strlen(s); + char ye[5],mo[3],da[3]; + strncpy(ye,s,4); + ye[4]='\0'; + strncpy(mo,s+4,2); + mo[2]='\0'; + strncpy(da,s+6,2); + da[2]='\0'; + struct date d; + d.y=atoi(ye); + d.m=atoi(mo); + d.d=atoi(da); + return d; +}; + + +int main() +{ + char str[10]; + struct date dt; + while(gets(str) != NULL) + { + dt = to_date(str); + printf("%d %d %d\n", dt.y, dt.m, dt.d); + } + return 0; +} + +/************************************************************** + Problem: 2688 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2689.c b/OpenJudge/QuestionAns/peerin/2689.c new file mode 100644 index 0000000..f04341a --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2689.c @@ -0,0 +1,34 @@ +#include +#include +// 1 2 3 5 8 13... +unsigned long long table[100000]={0,1,2,3,5,8,13,0}; +unsigned long long fr(int n){ +if(table[n]==0){ + table[n-1]=fr(n-1); + table[n-2]=fr(n-2); + table[n]=table[n-1]+table[n-2]; + return table[n]; +}else{ +return table[n]; +} +} + +int main() +{ + int n; + scanf("%d",&n); + unsigned long long res = fr(n); + printf("%llu",res); + return 0; +} + + +/************************************************************** + Problem: 2689 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:1528 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2690.c b/OpenJudge/QuestionAns/peerin/2690.c new file mode 100644 index 0000000..9c5cf38 --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2690.c @@ -0,0 +1,36 @@ +#include +#include +#include + +int youguan(int n){ +if(n==7||n%7==0) return 1; +else{ + char buf[100]={0}; + sprintf(buf,"%d",n); + int len = strlen(buf); + for(int i = 0;i +#include +#include +#include + +int main() +{ + char s[100]={0}; + while(scanf("%s",s)!=EOF){ + int len = strlen(s); + int res=0; + for(int i = 0;i='0'&&s[i]<='9') num=s[i]-'0'; + else num=s[i]-'A'+10; + res+=pow(16,len-1-i)*num; + } + printf("%d\n",res); + } + return 0; +} + +/************************************************************** + Problem: 2691 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:760 kb +****************************************************************/ + diff --git a/OpenJudge/QuestionAns/peerin/2692.c b/OpenJudge/QuestionAns/peerin/2692.c new file mode 100644 index 0000000..271eecd --- /dev/null +++ b/OpenJudge/QuestionAns/peerin/2692.c @@ -0,0 +1,20 @@ +#include +#include + +int main() +{ + int n; + scanf("%d",&n); + for(int i = n*n-n+1,cnt=0;cntlen(tt)-4: - codeurl = 'http://cise.sdust.edu.cn/OJ/append_detail.php?lang=0&pid=' + id + codeurl = 'http://192.168.119.211/JudgeOnline/append_detail.php?lang=0&pid=' + id # print(codeurl) coderes = requests.get(url=codeurl) codehtml = etree.HTML(coderes.content.decode("utf-8")) @@ -98,7 +98,7 @@ def mkProblem(url,ck): elif tt[i] == ', ': continue elif tt[i] in ['append.cc'] and i>len(tt)-2: - codeurl = 'http://cise.sdust.edu.cn/OJ/append_detail.php?lang=1&pid=' + id + codeurl = 'http://192.168.119.211/JudgeOnline/append_detail.php?lang=1&pid=' + id # print(codeurl) coderes = requests.get(url=codeurl) codehtml = etree.HTML(coderes.content.decode("utf-8")) diff --git a/ProblemSet/1008/input b/ProblemSet/1008/input index e5093ee..d5e91dc 100644 --- a/ProblemSet/1008/input +++ b/ProblemSet/1008/input @@ -1,2 +1,2 @@ --1 -1 +-1 +1 diff --git a/ProblemSet/1008/output b/ProblemSet/1008/output index 6ed281c..3abe059 100644 --- a/ProblemSet/1008/output +++ b/ProblemSet/1008/output @@ -1,2 +1,2 @@ -1 -1 +1 +1 diff --git a/ProblemSet/1008/problem.md b/ProblemSet/1008/problem.md index d3b1ca9..e33f608 100644 --- a/ProblemSet/1008/problem.md +++ b/ProblemSet/1008/problem.md @@ -13,16 +13,15 @@ Time Limit: 1 Sec  Memory Limit: 2 MB ## Sample Input ``` --1 -1 +-1 +1 ``` ## Sample Output ``` -1 -1 +1 +1 ``` ## HINT -求绝对值可以用标准库函数来完成,也可以自己判断。注意浮点数的输出格式。求绝对值的函数在哪个头文件?貌似很多人会搞错,包括很多编书的人! \ No newline at end of file diff --git a/ProblemSet/1073/input b/ProblemSet/1073/input new file mode 100644 index 0000000..2a69dfb --- /dev/null +++ b/ProblemSet/1073/input @@ -0,0 +1,5 @@ +a + b +b - z +a+b--+c++ +c+f--+--a + f-- + c-- + d-++e \ No newline at end of file diff --git a/ProblemSet/1073/output b/ProblemSet/1073/output new file mode 100644 index 0000000..788a431 --- /dev/null +++ b/ProblemSet/1073/output @@ -0,0 +1,24 @@ +Expression: a + b + value = 3 + a = 1 + b = 2 +Expression: b - z + value = -24 + b = 2 + z = 26 +Expression: a+b--+c++ + value = 6 + a = 1 + b = 1 + c = 4 +Expression: c+f--+--a + value = 9 + a = 0 + c = 3 + f = 5 +Expression: f-- + c-- + d-++e + value = 7 + c = 2 + d = 4 + e = 6 + f = 5 \ No newline at end of file diff --git a/ProblemSet/1073/problem.md b/ProblemSet/1073/problem.md new file mode 100644 index 0000000..17de126 --- /dev/null +++ b/ProblemSet/1073/problem.md @@ -0,0 +1,71 @@ +# 简单的C表达式求值 +Time Limit: 1 Sec  Memory Limit: 16 MB + + +## Description +这道题的任务是求一些简单的C语言表达式的值,但是你并不需要知道C语言如何解决这个问题。每个表达式占一行并且不超过110个字符,只会包含简单的整数值和有限的一系列运算符且不含常数。表达式中一共可能会出现26个变量,从a到z(只是小写字母)。在每个表达式求值的时候,这26个变量的初始值为1依次到26(即a = 1,b = 2,...,n = 14,o = 15,……,z = 26)。每个变量在一个表达式中最多出现一次,并且很多变量可能根本没有用上。 + +可能出现在表达式中的运算符包括二元(需要两个操作数)运算符+和-,和通常的意思一样。因此表达式a + c - d + b的值为2(按照1 + 3 - 4 + 2计算)。另外可能出现的运算符是++和--。它们是一元(只需一个操作数)运算符,可能在任意变量的前面或后面出现。当++运算符在一个变量前面出现的时候,该变量会在求整个表达式的值之前自增(加1)。因此表达式++c - b是2,因为在计算整个表达式之前c自增到了4。当++运算符出现在一个变量之后的时候,该变量会在整个表达式求值完成之后自增(同样地,加1)。因此表达式c++ - b的值是1,但是c会在表达式求值完成之后自增,它的值还会是4。--运算符同样会在一个元素之前或之后使用来使变量自减(减1)。运算符在变量的前面和后面的效果和++运算符类似。因此表达式--c + b--的值是4,同时c和b在表达式求值之后的值分别为2和1。 + +还有一种解释++和--运算符的算法。为了简便,我们只考虑++运算符: + + + 区分出每个前面有++运算符的变量。生成使每个这样的变量自增,并且删除变量之前的++运算符的简单任务声明。 + 类似地,区分出每个后面有++运算符的变量。生成使每个这样的变量自增,然后删除变量之后的++运算符的简单任务声明。 + 现在表达式中的变量前面和后面都不再含有++运算符了。生成使程序在第一步编写的任务声明之后,在第二步编写的任务声明之前计算表达式的值的声明。 + 执行第一步生成的声明,然后是第三步生成的,最后是第二步的。 + +使用这样的算法,计算表达式++a + b++等于计算: + + + a = a + 1(由算法第一步生成) + 表达式 = a + b(由第三步生成) + b = b + 1(由第二步生成) + +最后表达式会接收完整的表达式的值 + +## Input +你编写的程序应当一个一行地读入表达式,直到读到文件末尾。原样地输出每个表达式,然后输出整个表达式的值,然后逐行输出求值后每个变量的值。不要输出没有用到的变量的值。下面的样例说明了准确的输出格式。 + +求值时空格应当忽略,并且保证一些有歧义表达式,如a+++b(因为既可以当做a++ + b也可以当做a + ++b,所以是有歧义的),并不会出现在输入中。同样地,++或--运算符不会同时出现在同一个变量的两侧。因此像++a++这样的表达式不会出现在输入当中。 + +## Output +同样例输出相同。 + +## Sample Input +``` +a + b +b - z +a+b--+c++ +c+f--+--a + f-- + c-- + d-++e +``` +## Sample Output +``` +Expression: a + b + value = 3 + a = 1 + b = 2 +Expression: b - z + value = -24 + b = 2 + z = 26 +Expression: a+b--+c++ + value = 6 + a = 1 + b = 1 + c = 4 +Expression: c+f--+--a + value = 9 + a = 0 + c = 3 + f = 5 +Expression: f-- + c-- + d-++e + value = 7 + c = 2 + d = 4 + e = 6 + f = 5 +``` + +## HINT diff --git a/ProblemSet/1103/input b/ProblemSet/1103/input new file mode 100644 index 0000000..e7e7d8e --- /dev/null +++ b/ProblemSet/1103/input @@ -0,0 +1 @@ +3 4 \ No newline at end of file diff --git a/ProblemSet/1103/output b/ProblemSet/1103/output new file mode 100644 index 0000000..dc9414b --- /dev/null +++ b/ProblemSet/1103/output @@ -0,0 +1 @@ +154 \ No newline at end of file diff --git a/ProblemSet/1103/problem.md b/ProblemSet/1103/problem.md new file mode 100644 index 0000000..bb8e7a7 --- /dev/null +++ b/ProblemSet/1103/problem.md @@ -0,0 +1,26 @@ +# 函数(递归) +Time Limit: 1 Sec  Memory Limit: 128 MB + + +## Description +用递归的方法编写函数求n阶勒让德多项式的值,在主程序中实现输入输出。递归公式: + + + + +## Input +依次输入两个整数,对应于n的值和x的值 + +## Output +输出pn(x)对应的值 + +## Sample Input +``` +3 4 +``` +## Sample Output +``` +154 +``` + +## HINT diff --git a/ProblemSet/1134/problem.md b/ProblemSet/1134/problem.md index 137cee4..9e46a67 100644 --- a/ProblemSet/1134/problem.md +++ b/ProblemSet/1134/problem.md @@ -17,7 +17,7 @@ Invalid Word(禁用单词)错误:在解决这个题目时,某些关键 ## Input -输入是多行,每行一个字符串s,至EOF结束。每个串s不超过10个字符,并且s转换后的整数不会超出int类型的表示范围。 +输入是多行,每行一个字符串s,至EOF结束。每个串s不超过11个字符,并且s转换后的整数不会超出int类型的表示范围。 s的转换规则是:从第一个字符开始的前若干个连续数字字符("0"~"9")和仅能出现在s首位的符号位("+"和"-")转换为一个十进制整数,直到第一个非数字字符为止。从第一个非数字字符开始(除了首位的"+"和'-'),都是非法字符。因此,如果一个串全部都是非法字符,那么它只能是0。 ## Output diff --git a/ProblemSet/1179/problem.md b/ProblemSet/1179/problem.md index 50d2402..3f98c84 100644 --- a/ProblemSet/1179/problem.md +++ b/ProblemSet/1179/problem.md @@ -1,5 +1,5 @@ # 筛选素数 -Time Limit: 1 Sec  Memory Limit: 16 MB +Time Limit: 2 Sec  Memory Limit: 16 MB ## Description diff --git a/ProblemSet/1212/input b/ProblemSet/1212/input new file mode 100644 index 0000000..5027aa5 --- /dev/null +++ b/ProblemSet/1212/input @@ -0,0 +1 @@ +5 3 \ No newline at end of file diff --git a/ProblemSet/1212/output b/ProblemSet/1212/output new file mode 100644 index 0000000..3f10ffe --- /dev/null +++ b/ProblemSet/1212/output @@ -0,0 +1 @@ +15 \ No newline at end of file diff --git a/ProblemSet/1212/problem.md b/ProblemSet/1212/problem.md new file mode 100644 index 0000000..d9a72c1 --- /dev/null +++ b/ProblemSet/1212/problem.md @@ -0,0 +1,33 @@ +# 递归计算两数乘积 +Time Limit: 1 Sec  Memory Limit: 128 MB + + +## Description +给出两个整数A和B,用递归的方法计算A*B。不过,这次你只能使用递归的方法。 +----------------------------------------------------------------------------- +Invalid Word(禁用单词)错误:在解决这个题目时,某些关键词是不允许被使用的。如果提交的程序中包含了下列的关键词之一,就会产生这个错误。 +被禁用的关键字:循环语句for、while,甚至包括分支语句的switch、case、goto、break。 +被禁用的头文件:math.h、stdlib.h。 +被禁用的字符: “/”、“*”、“[”和“]”。 +你不能使用乘法或除法,只能使用加法和减法。 + + +## Input +输入为两个数值很小的整数A、B。 + + +## Output +输出为一个整数C,满足C = A * B。 + + +## Sample Input +``` +5 3 +``` +## Sample Output +``` +15 +``` + +## HINT + 有一种整数叫做负数吧。哦,还有一种叫做0。 \ No newline at end of file diff --git a/ProblemSet/1236/problem.md b/ProblemSet/1236/problem.md index 33092bc..59b03a0 100644 --- a/ProblemSet/1236/problem.md +++ b/ProblemSet/1236/problem.md @@ -1,4 +1,4 @@ -# A+B Problem (VIII) : Pointer Practice (Append Code) +# A+B Problem (X) : Pointer Practice (Append Code) Time Limit: 1 Sec  Memory Limit: 2 MB diff --git a/ProblemSet/1490/input b/ProblemSet/1490/input new file mode 100644 index 0000000..62e3943 --- /dev/null +++ b/ProblemSet/1490/input @@ -0,0 +1,2 @@ +I LOVE YOU +HELLO WORLD diff --git a/ProblemSet/1490/output b/ProblemSet/1490/output new file mode 100644 index 0000000..16ead67 --- /dev/null +++ b/ProblemSet/1490/output @@ -0,0 +1,2 @@ +444055566688833099966688 +44335551555666096667775553 diff --git a/ProblemSet/1490/problem.md b/ProblemSet/1490/problem.md new file mode 100644 index 0000000..25064d8 --- /dev/null +++ b/ProblemSet/1490/problem.md @@ -0,0 +1,33 @@ +# 该按哪些键 +Time Limit: 1 Sec  Memory Limit: 128 MB + + +## Description +       Peter在手机上打字时一直用全键键盘来输入,但最近不知道怎么搞的,把全键键盘弄丢了,只剩下了9键键盘。一项喜欢高科技的Peter却不会用9键键盘打字。So,please help him! + +       9键键盘如上图所示。如果要输入字母'A',我们只需要按一次数字键2;如果要输入空格,则需要按数字键0;如果要输入字母'B'的话,我们需要连续按两次数字键2,按键序列为22。如果要输入的两个大写字母都在同一个数字键上,则需要按数字1作为分隔符,例如输入字母’JL’,需要先按一次数字键5,再按一次数字键1,再按3次数字键5,按键序列为51555。 +       为了使问题简化,我们假设Peter要输入的内容只有大写英文字母和空格。 + + +## Input +    输入有多组测试用例。每组测试用例占一行,为Peter要输入的内容,不超过20000个字符。 + + +## Output +    对于每组测试用例,输出一行,为得到所有内容所要按下的按键序列。 + + +## Sample Input +``` +I LOVE YOU +HELLO WORLD + +``` +## Sample Output +``` +444055566688833099966688 +44335551555666096667775553 + +``` + +## HINT diff --git a/ProblemSet/1494/problem.md b/ProblemSet/1494/problem.md index f2c839f..0e1fd05 100644 --- a/ProblemSet/1494/problem.md +++ b/ProblemSet/1494/problem.md @@ -1,4 +1,4 @@ -# 用结构体来表示数组 +# 用结构体来表示数组(Append Code) Time Limit: 1 Sec  Memory Limit: 128 MB diff --git a/ProblemSet/1503/problem.md b/ProblemSet/1503/problem.md index f96f8b0..bd6f9b9 100644 --- a/ProblemSet/1503/problem.md +++ b/ProblemSet/1503/problem.md @@ -3,7 +3,7 @@ Time Limit: 1 Sec  Memory Limit: 128 MB ## Description -我们知道,5/3=1+3/5,称等号后面的式子为最简分式。也就是说,在分式中,分子一定要小于分母,而且分子、分母是互质的。请写一个程序,对于用户输入的一个合法分式,输出其约简之后的结果。 +我们知道,5/3=1+2/3,称等号后面的式子为最简分式。也就是说,在分式中,分子一定要小于分母,而且分子、分母是互质的。请写一个程序,对于用户输入的一个合法分式,输出其约简之后的结果。 diff --git a/ProblemSet/1607/problem.md b/ProblemSet/1607/problem.md index 8cc43d6..adc9666 100644 --- a/ProblemSet/1607/problem.md +++ b/ProblemSet/1607/problem.md @@ -5,13 +5,13 @@ Time Limit: 1 Sec  Memory Limit: 2 MB ## Description -         从标准输入读取了多少个数字? +从标准输入读取了多少个数字?   -         用C语言或C++编写函数实现,append.c中调用的函数为: -                   int get_nums(); //请自行设计函数参数,使程序编译正确。 -                   功能:从标准输入读取若干整数,返回读取的整数个数。 +用C语言或C++编写函数实现,append.c中调用的函数为: +        int get_nums(); //请自行设计函数参数,使程序编译正确。 +        功能:从标准输入读取若干整数,返回读取的整数个数。 -         函数的调用格式见“Append Code”。 +函数的调用格式见“Append Code”。 ## Input diff --git a/ProblemSet/1634/problem.md b/ProblemSet/1634/problem.md index e03ce9a..2adf1c9 100644 --- a/ProblemSet/1634/problem.md +++ b/ProblemSet/1634/problem.md @@ -8,8 +8,7 @@ Time Limit: 1 Sec  Memory Limit: 16 MB ## Input 首先输入两个数m和n,满足0> s >> t; + str_swap(s, t); + cout << s << endl; + cout << t << endl; +} + +``` diff --git a/ProblemSet/2517/input b/ProblemSet/2517/input new file mode 100644 index 0000000..e3e471a --- /dev/null +++ b/ProblemSet/2517/input @@ -0,0 +1,2 @@ +12:13:40 +20:30:45 diff --git a/ProblemSet/2517/output b/ProblemSet/2517/output new file mode 100644 index 0000000..a020316 --- /dev/null +++ b/ProblemSet/2517/output @@ -0,0 +1,2 @@ +20:30:45 +12:13:40 diff --git a/ProblemSet/2517/problem.md b/ProblemSet/2517/problem.md new file mode 100644 index 0000000..e71533a --- /dev/null +++ b/ProblemSet/2517/problem.md @@ -0,0 +1,61 @@ +# 时间的交换(Append code) +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +         用C语言自定义结构体类型time来表示时间,用来存储小时、分钟、秒三个量。编写函数get_time()、put_time()、time_swap()实现对时间的输入、输出和交换功能。请根据“append.c”文件内容定义类型并设计函数,使程序编译正确。 +         用C++语言定义Time类型,并实现函数time_swap(),请根据“append.cc”文件内容定义类型并设计函数,使程序编译正确。 +         函数的调用格式见“Append Code”。 + + +## Input +         输入为两行,每行为一个时间包括时、分、秒三部分,中间用“:”分隔。 + + +## Output +         输出为两行,与输入顺序相反。 + + +## Sample Input +``` +12:13:40 +20:30:45 + +``` +## Sample Output +``` +20:30:45 +12:13:40 + +``` + +## HINT + + +## Append Code +### append.c +```c +int main() +{ + struct time tm, tn; + get_time(&tm); + get_time(&tn); + time_swap(&tm, &tn); + put_time(tm); + put_time(tn); + return 0; +} + +``` +### append.cc +```cpp +int main() +{ + Time tm, tn; + cin >> tm >> tn; + time_swap(tm, tn); + cout << tm << " " << tn; + return 0; +} + +``` diff --git a/ProblemSet/2518/input b/ProblemSet/2518/input new file mode 100644 index 0000000..97e3504 --- /dev/null +++ b/ProblemSet/2518/input @@ -0,0 +1 @@ +110 \ No newline at end of file diff --git a/ProblemSet/2518/output b/ProblemSet/2518/output new file mode 100644 index 0000000..0dd21b7 --- /dev/null +++ b/ProblemSet/2518/output @@ -0,0 +1 @@ +011 diff --git a/ProblemSet/2518/problem.md b/ProblemSet/2518/problem.md new file mode 100644 index 0000000..cfed790 --- /dev/null +++ b/ProblemSet/2518/problem.md @@ -0,0 +1,59 @@ +# 递归求倒序数一(Append Code) +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +         给出一个无符号整数n<264,求出n的倒序数字。 +  +         请根据“Append Code”完成程序。append.c中调用了一个函数rev (n),用来倒转输出数字n。用C语言或C++编写自定义类型和函数实现,函数的原型为: +                  int rev(ungsigned long long); +         函数的调用格式见“Append Code”。 +         ----------------------------------------------------------------------------- +         Invalid Word(禁用单词)错误:在解决这个题目时,某些关键词是不允许被使用的。如果提交的程序中包含了下列的关键词之一,就会产生这个错误。 +         被禁用的关键字:for, while, do, break, continue, goto。 + + +## Input +         输入一个小于264的无符号整数n。 + + +## Output +         输出n的倒序数。 + + +## Sample Input +``` +110 +``` +## Sample Output +``` +011 + +``` + +## HINT + + +## Append Code +### append.c +```c +int main() +{ + unsigned long long n, r; + scanf("%llu", &n); + rev(n); + printf("\n"); +} + +``` +### append.cc +```cpp +int main() +{ + unsigned long long n, r; + cin >> n; + rev(n); + cout << endl; +} + +``` diff --git a/ProblemSet/2519/input b/ProblemSet/2519/input new file mode 100644 index 0000000..97e3504 --- /dev/null +++ b/ProblemSet/2519/input @@ -0,0 +1 @@ +110 \ No newline at end of file diff --git a/ProblemSet/2519/output b/ProblemSet/2519/output new file mode 100644 index 0000000..bd661ea --- /dev/null +++ b/ProblemSet/2519/output @@ -0,0 +1 @@ +110 diff --git a/ProblemSet/2519/problem.md b/ProblemSet/2519/problem.md new file mode 100644 index 0000000..c935d38 --- /dev/null +++ b/ProblemSet/2519/problem.md @@ -0,0 +1,60 @@ +# 整数转动态内存字符串(Append Code) +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +         用C语言编写一个函数to_str(),将一个整型转换为一个字符串返回,这个字符串需要分配动态内存。 +  +         请根据“Append Code”完成程序。append.c中调用了一个函数to_str (),原型为: +                  char *to_str(ungsigned long long); +         函数的调用格式见“Append Code”。 + + +## Input +         输入一个小于264的无符号整数n。 + + +## Output +         用字符串形式输出n。 + + +## Sample Input +``` +110 +``` +## Sample Output +``` +110 + +``` + +## HINT + + +## Append Code +### append.c +```c +int main() +{ + char *s; + unsigned long long n; + scanf("%llu", &n); + s = to_str(n); + puts(s); + free(s); +} + +``` +### append.cc +```cpp +int main() +{ + char *s; + unsigned long long n; + cin >> n; + s = to_str(n); + cout << s << endl; + delete s; +} + +``` diff --git a/ProblemSet/2520/input b/ProblemSet/2520/input new file mode 100644 index 0000000..3767b4b --- /dev/null +++ b/ProblemSet/2520/input @@ -0,0 +1 @@ +3.14 \ No newline at end of file diff --git a/ProblemSet/2520/output b/ProblemSet/2520/output new file mode 100644 index 0000000..90c9a63 --- /dev/null +++ b/ProblemSet/2520/output @@ -0,0 +1 @@ +3 diff --git a/ProblemSet/2520/problem.md b/ProblemSet/2520/problem.md new file mode 100644 index 0000000..25f6057 --- /dev/null +++ b/ProblemSet/2520/problem.md @@ -0,0 +1,27 @@ +# 浮点数向零舍入 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +         输入一个单精度浮点数,将其向零舍入到整数。向零摄入的含义是:正数向下舍入,负数向上舍入。 + + +## Input +         一个单精度浮点数f。 + + +## Output +         一个整数,即f向零舍入的结果。 + + +## Sample Input +``` +3.14 +``` +## Sample Output +``` +3 + +``` + +## HINT diff --git a/ProblemSet/2521/input b/ProblemSet/2521/input new file mode 100644 index 0000000..2b20c38 --- /dev/null +++ b/ProblemSet/2521/input @@ -0,0 +1 @@ +ATATGGATGGTGTTTGGCTCTG \ No newline at end of file diff --git a/ProblemSet/2521/output b/ProblemSet/2521/output new file mode 100644 index 0000000..947b185 --- /dev/null +++ b/ProblemSet/2521/output @@ -0,0 +1 @@ +TATACCTACCACAAACCGAGAC diff --git a/ProblemSet/2521/problem.md b/ProblemSet/2521/problem.md new file mode 100644 index 0000000..5383e0b --- /dev/null +++ b/ProblemSet/2521/problem.md @@ -0,0 +1,32 @@ +# 配对碱基链 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +         脱氧核糖核酸(DNA)由两条互补的碱基链以双螺旋的方式结合而成。构成DNA的碱基共有4种,分别为腺嘌呤(A)、鸟嘌呤(G)、胸腺嘧啶(T)和胞嘧啶(C)。在两条互补碱基链的对应位置上,腺嘌呤总是和胸腺嘧啶配对,鸟嘌呤总是和胞嘧啶配对。 + + +         你的任务是根据一条单链上的碱基序列,给出对应的互补链上的碱基序列。 + + + + +## Input +         输入是一个字符串,表示一条碱基链。这个字符串只含有大写字母A、T、G、C,分别表示腺嘌呤、胸腺嘧啶、鸟嘌呤和胞嘧啶。字符串长度不超过255。 + + +## Output +         输出一个只有大写字母A、T、G、C组成的字符串,这个串是输入的碱基链互补的碱基链。 + + +## Sample Input +``` +ATATGGATGGTGTTTGGCTCTG +``` +## Sample Output +``` +TATACCTACCACAAACCGAGAC + +``` + +## HINT diff --git a/ProblemSet/2522/input b/ProblemSet/2522/input new file mode 100644 index 0000000..93fb071 --- /dev/null +++ b/ProblemSet/2522/input @@ -0,0 +1,10 @@ +int +for +float +double +for +while +short +do +if +break diff --git a/ProblemSet/2522/output b/ProblemSet/2522/output new file mode 100644 index 0000000..333af37 --- /dev/null +++ b/ProblemSet/2522/output @@ -0,0 +1,10 @@ +break +do +double +float +for +for +if +int +short +while diff --git a/ProblemSet/2522/problem.md b/ProblemSet/2522/problem.md new file mode 100644 index 0000000..067bd1a --- /dev/null +++ b/ProblemSet/2522/problem.md @@ -0,0 +1,49 @@ +# 单词的字典序 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +         编写程序对若干英文单词进行排序。 +         这里,英文单词是只包含26个小写字母不含其它符号,长度上限为50字符的串。 +         排序依据是英文单词的字典序从小到大排列。所谓字典序,就是按照英文字典的顺序排列:即两串从第一个不相同的字符处依据字母a-z的顺序(字母中a最小、z最大)排列次序。 +         例如:ab abc ac是按照字典序从小到大排列的。 + + +## Input +         输入不超过100行,每行一个长度上限为50个字母的单词。 + + +## Output +         按照字典序从小到大排列这些单词,每行输出一个单词。 + + +## Sample Input +``` +int +for +float +double +for +while +short +do +if +break + +``` +## Sample Output +``` +break +do +double +float +for +for +if +int +short +while + +``` + +## HINT diff --git a/ProblemSet/2523/input b/ProblemSet/2523/input new file mode 100644 index 0000000..48f9b44 --- /dev/null +++ b/ProblemSet/2523/input @@ -0,0 +1,2 @@ +I love you +Hello World diff --git a/ProblemSet/2523/output b/ProblemSet/2523/output new file mode 100644 index 0000000..16ead67 --- /dev/null +++ b/ProblemSet/2523/output @@ -0,0 +1,2 @@ +444055566688833099966688 +44335551555666096667775553 diff --git a/ProblemSet/2523/problem.md b/ProblemSet/2523/problem.md new file mode 100644 index 0000000..f66b707 --- /dev/null +++ b/ProblemSet/2523/problem.md @@ -0,0 +1,35 @@ +# 该按哪些键2 +Time Limit: 1 Sec  Memory Limit: 128 MB + + +## Description +         Peter在手机上打字时一直用全键键盘来输入,但最近不知道怎么搞的,把全键键盘弄丢了,只剩下了9键键盘。一项喜欢高科技的Peter却不会用9键键盘打字。 + +         9键键盘如上图所示。如果要输入字母'A',我们只需要按一次数字键2;如果要输入空格,则需要按数字键0;如果要输入字母'B'的话,我们需要连续按两次数字键2,按键序列为22。如果要输入的两个大写字母都在同一个数字键上,则需要按数字1作为分隔符,例如输入字母’JL’,需要先按一次数字键5,再按一次数字键1,再按3次数字键5,按键序列为51555。 + +    我们假设Peter的输入内容只有英文字母和空格,且同一个英文字母的大小写按键都是一样的。 + + + +## Input +         输入有多组测试用例。每组测试用例占一行,为Peter要输入的内容,不超过20000个字符。 + + +## Output +         对于每组测试用例,输出一行,为得到所有内容所要按下的按键序列。 + + +## Sample Input +``` +I love you +Hello World + +``` +## Sample Output +``` +444055566688833099966688 +44335551555666096667775553 + +``` + +## HINT diff --git a/ProblemSet/2598/input b/ProblemSet/2598/input new file mode 100644 index 0000000..87291cd --- /dev/null +++ b/ProblemSet/2598/input @@ -0,0 +1,3 @@ +1 2 +10 20 +0 0 diff --git a/ProblemSet/2598/output b/ProblemSet/2598/output new file mode 100644 index 0000000..225bd14 --- /dev/null +++ b/ProblemSet/2598/output @@ -0,0 +1,2 @@ +3 +30 diff --git a/ProblemSet/2598/problem.md b/ProblemSet/2598/problem.md new file mode 100644 index 0000000..592f07d --- /dev/null +++ b/ProblemSet/2598/problem.md @@ -0,0 +1,60 @@ +# A+B Problem (IX) : Recursion Practice (Append Code) +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +计算a+b,0<=a,b<1000。 +----------------------------------------------------------------------------- +编写一个函数add()。函数原型为 +      int add(); +      功能:函数读入a和b的值,并输出a+b。用递归的方法编写,n是递归的次数。 +函数add()的调用格式见“Append Code”。 +----------------------------------------------------------------------------- +Invalid Word(禁用单词)错误:在解决这个题目时,某些关键词是不允许被使用的。如果提交的程序中包含了下列的关键词之一,就会产生这个错误。 +被禁用的关键字:for, while, do, break, continue, goto。 + + +## Input +输入有多对整数a和b组成,每对a和b占一行,a,b用空格分开。当测试样为0 0时表示输入结束,0 0不参与运算。 + + +## Output +每行输出一个a+b的值,顺序与输入对应。 + + +## Sample Input +``` +1 2 +10 20 +0 0 + +``` +## Sample Output +``` +3 +30 + +``` + +## HINT + + +## Append Code +### append.c +```c +int main() +{ + int N; + add(); +} + +``` +### append.cc +```cpp +int main() +{ + int N; + add(); +} + +``` diff --git a/ProblemSet/2599/input b/ProblemSet/2599/input new file mode 100644 index 0000000..294d779 --- /dev/null +++ b/ProblemSet/2599/input @@ -0,0 +1,3 @@ +1 +2 +3 diff --git a/ProblemSet/2599/output b/ProblemSet/2599/output new file mode 100644 index 0000000..294d779 --- /dev/null +++ b/ProblemSet/2599/output @@ -0,0 +1,3 @@ +1 +2 +3 diff --git a/ProblemSet/2599/problem.md b/ProblemSet/2599/problem.md new file mode 100644 index 0000000..cc1cc49 --- /dev/null +++ b/ProblemSet/2599/problem.md @@ -0,0 +1,35 @@ +# 递归求解爬楼梯 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +有一楼梯共M级,若每次只能跨上一级或二级,要走上第M级,共有多少种走法? +----------------------------------------------------------------------------- +Invalid Word(禁用单词)错误:在解决这个题目时,某些关键词是不允许被使用的。如果提交的程序中包含了下列的关键词之一,就会产生这个错误。 +被禁用的关键字:for, while, do, break, continue, goto。 + + +## Input +输入数据每行包含一个整数M(1<=M<=30),表示楼梯的级数,至EOF结束。 + + +## Output +对于每个测试实例,请输出不同走法的数量 + + +## Sample Input +``` +1 +2 +3 + +``` +## Sample Output +``` +1 +2 +3 + +``` + +## HINT diff --git a/ProblemSet/2600/input b/ProblemSet/2600/input new file mode 100644 index 0000000..5d3f903 --- /dev/null +++ b/ProblemSet/2600/input @@ -0,0 +1 @@ +31859 3 diff --git a/ProblemSet/2600/output b/ProblemSet/2600/output new file mode 100644 index 0000000..129a793 --- /dev/null +++ b/ProblemSet/2600/output @@ -0,0 +1 @@ +8 diff --git a/ProblemSet/2600/problem.md b/ProblemSet/2600/problem.md new file mode 100644 index 0000000..ec2f5f6 --- /dev/null +++ b/ProblemSet/2600/problem.md @@ -0,0 +1,53 @@ +# digit函数一 (Append Code) +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +在程序中定义一函数digit(n,k),它能分离出整数n从右边数第k个数字。 +函数的调用格式见“Append Code”。 +----------------------------------------------------------------------------- +Invalid Word(禁用单词)错误:在解决这个题目时,某些关键词是不允许被使用的。如果提交的程序中包含了下列的关键词之一,就会产生这个错误。 +被禁用的关键字:for, while, do, break, continue, goto。 + + +## Input +非负整数n和k,k不超n的十进制位数,n不超int范围。 + + +## Output +一个数字。 + + +## Sample Input +``` +31859 3 + +``` +## Sample Output +``` +8 + +``` + +## HINT + 可以使用递归解决 + +## Append Code +### append.c +```c +int main() +{ + int n, k; + scanf("%d%d", &n, &k); + printf("%d\n", digit(n, k)); +} +``` +### append.cc +```cpp +int main() +{ + int n, k; + cin >> n >> k; + cout << digit(n, k) << endl; +} +``` diff --git a/ProblemSet/2601/input b/ProblemSet/2601/input new file mode 100644 index 0000000..d786b22 --- /dev/null +++ b/ProblemSet/2601/input @@ -0,0 +1 @@ +31859 \ No newline at end of file diff --git a/ProblemSet/2601/output b/ProblemSet/2601/output new file mode 100644 index 0000000..e440e5c --- /dev/null +++ b/ProblemSet/2601/output @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/ProblemSet/2601/problem.md b/ProblemSet/2601/problem.md new file mode 100644 index 0000000..6a78385 --- /dev/null +++ b/ProblemSet/2601/problem.md @@ -0,0 +1,57 @@ +# digit函数二 (Append Code) +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +在程序中定义一函数digit(n),它能分离出整数最左边的数字。 + +函数的调用格式见“Append Code”。 + +----------------------------------------------------------------------------- + +Invalid Word(禁用单词)错误:在解决这个题目时,某些关键词是不允许被使用的。如果提交的程序中包含了下列的关键词之一,就会产生这个错误。 + +被禁用的关键字:for, while, do, break, continue, goto。 + + +## Input +非负整数n,n不超int范围。 + + +## Output +一个数字 + + +## Sample Input +``` +31859 +``` +## Sample Output +``` +3 +``` + +## HINT + + +## Append Code +### append.c +```c +int main() +{ + int n; + scanf("%d", &n); + printf("%d\n", digit(n)); +} + +``` +### append.cc +```cpp +int main() +{ + int n; + cin >> n; + cout << digit(n); +} + +``` diff --git a/ProblemSet/2602/input b/ProblemSet/2602/input new file mode 100644 index 0000000..a4628b0 --- /dev/null +++ b/ProblemSet/2602/input @@ -0,0 +1 @@ +1 2 3 4 5 6 7 8 9 10 diff --git a/ProblemSet/2602/output b/ProblemSet/2602/output new file mode 100644 index 0000000..2a0b5e9 --- /dev/null +++ b/ProblemSet/2602/output @@ -0,0 +1 @@ +10 10 \ No newline at end of file diff --git a/ProblemSet/2602/problem.md b/ProblemSet/2602/problem.md new file mode 100644 index 0000000..815eee0 --- /dev/null +++ b/ProblemSet/2602/problem.md @@ -0,0 +1,32 @@ +# 递归求最大值 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +输入一组数字,用递归的方法统计个数,并输出最大值。 +----------------------------------------------------------------------------- +Invalid Word(禁用单词)错误:在解决这个题目时,某些关键词是不允许被使用的。如果提交的程序中包含了下列的关键词之一,就会产生这个错误。 +被禁用的关键字:循环语句for、while,甚至包括分支语句的switch、case、goto。 + + + +## Input +输入为若干int范围内的正整数,不超过1000个。 + + + +## Output +输出为这些正整数的个数和其中最大的数值。 + + +## Sample Input +``` +1 2 3 4 5 6 7 8 9 10 + +``` +## Sample Output +``` +10 10 +``` + +## HINT diff --git a/ProblemSet/2606/input b/ProblemSet/2606/input new file mode 100644 index 0000000..d2ed06d --- /dev/null +++ b/ProblemSet/2606/input @@ -0,0 +1 @@ +31859 3 \ No newline at end of file diff --git a/ProblemSet/2606/output b/ProblemSet/2606/output new file mode 100644 index 0000000..301160a --- /dev/null +++ b/ProblemSet/2606/output @@ -0,0 +1 @@ +8 \ No newline at end of file diff --git a/ProblemSet/2606/problem.md b/ProblemSet/2606/problem.md new file mode 100644 index 0000000..2d090c1 --- /dev/null +++ b/ProblemSet/2606/problem.md @@ -0,0 +1,34 @@ +# digit函数三 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +编写一个程序,它能分离出整数n从左边数第k个数字。 + +函数的调用格式见“Append Code”。 + +----------------------------------------------------------------------------- + +Invalid Word(禁用单词)错误:在解决这个题目时,某些关键词是不允许被使用的。如果提交的程序中包含了下列的关键词之一,就会产生这个错误。 + +被禁用的关键字:for, while, do, break, continue, goto。 + + +## Input +非负整数n和k,k不超n的十进制位数,n不超int范围。 + + +## Output +一个数字。 + + +## Sample Input +``` +31859 3 +``` +## Sample Output +``` +8 +``` + +## HINT diff --git a/ProblemSet/2608/input b/ProblemSet/2608/input new file mode 100644 index 0000000..df11051 --- /dev/null +++ b/ProblemSet/2608/input @@ -0,0 +1 @@ +1 2 diff --git a/ProblemSet/2608/output b/ProblemSet/2608/output new file mode 100644 index 0000000..630b639 --- /dev/null +++ b/ProblemSet/2608/output @@ -0,0 +1 @@ +0.40 diff --git a/ProblemSet/2608/problem.md b/ProblemSet/2608/problem.md new file mode 100644 index 0000000..9096081 --- /dev/null +++ b/ProblemSet/2608/problem.md @@ -0,0 +1,35 @@ +# 递归求解函数 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +递归求解函数f(x,n) + + +----------------------------------------------------------------------------- + +Invalid Word(禁用单词)错误:在解决这个题目时,某些关键词是不允许被使用的。如果提交的程序中包含了下列的关键词之一,就会产生这个错误。 + +被禁用的关键字:for, while, do, break, continue, goto。 + + + +## Input +第一个数是实数x,第二个数是整数n。 + +## Output +函数值,保留两位小数 + + +## Sample Input +``` +1 2 + +``` +## Sample Output +``` +0.40 + +``` + +## HINT diff --git a/ProblemSet/2610/input b/ProblemSet/2610/input new file mode 100644 index 0000000..6ad1e30 --- /dev/null +++ b/ProblemSet/2610/input @@ -0,0 +1 @@ +2 2 \ No newline at end of file diff --git a/ProblemSet/2610/output b/ProblemSet/2610/output new file mode 100644 index 0000000..72d5566 --- /dev/null +++ b/ProblemSet/2610/output @@ -0,0 +1,5 @@ +2 + 2 = 4 +2 - 2 = 0 +2 * 2 = 4 +2 / 2 = 1 +2 % 2 = 0 diff --git a/ProblemSet/2610/problem.md b/ProblemSet/2610/problem.md new file mode 100644 index 0000000..2e20a71 --- /dev/null +++ b/ProblemSet/2610/problem.md @@ -0,0 +1,48 @@ +# 编写函数:四则运算二 (Append Code) +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +两整数四则运算。 +用C语言或C++编写函数实现,append.c中通过函数指针数组fp调用5个函数add()、sub()、mul()、div()、mod()的功能分别为加、减、乘、除、求余。请根据“Append Code”自行设计函数和数据结构,使程序编译正确。 +函数的调用格式见“Append Code”。 + + +## Input +输入为两个整数a、b。 + + +## Output +输出五行,分别为a和b加减乘除、求余的式子和结果。具体格式见sample。 + + +## Sample Input +``` +2 2 +``` +## Sample Output +``` +2 + 2 = 4 +2 - 2 = 0 +2 * 2 = 4 +2 / 2 = 1 +2 % 2 = 0 + +``` + +## HINT + + +## Append Code +### append.c +```c +int main() +{ + int a, b, i; + scanf("%d %d", &a, &b); + for(i = 0; i < 5; i++) + printf("%d %c %d = %d\n", a, op[i], b, fp[i](a, b)); + return 0; +} + +``` diff --git a/ProblemSet/2611/input b/ProblemSet/2611/input new file mode 100644 index 0000000..66b9f79 --- /dev/null +++ b/ProblemSet/2611/input @@ -0,0 +1,4 @@ +10 5 8 1 4 3 2 9 0 6 7 +6 0.2 2.1 1.6 6.3 3.5 5.4 +8 adc ad d ab abc b acb abb +5 10/10/2000 02/10/2012 01/10/2010 01/10/2012 02/01/2000 diff --git a/ProblemSet/2611/output b/ProblemSet/2611/output new file mode 100644 index 0000000..513d71a --- /dev/null +++ b/ProblemSet/2611/output @@ -0,0 +1,4 @@ +9 8 7 6 5 4 3 2 1 0 +0.2 1.6 2.1 3.5 5.4 6.3 +b d ab ad abb abc acb adc +2000-02-01 2000-10-10 2010-01-10 2012-01-10 2012-02-10 diff --git a/ProblemSet/2611/problem.md b/ProblemSet/2611/problem.md new file mode 100644 index 0000000..aaba6e7 --- /dev/null +++ b/ProblemSet/2611/problem.md @@ -0,0 +1,97 @@ +# 类型无关的排序(Append Code) +Time Limit: 1 Sec  Memory Limit: 16 MB + + +## Description +写一组抽象的输入、输出和排序的函数。要求能对用数组存储的任意类型数据排序,即忽略数据的差异并通过回调函数开放出与数据紧密相关的操作。 + +输入函数原型: +    int get_arr(void *ar, int sz, int (*get)(void*)); +    参数:ar为输入数组的首地址、sz为数组每个单元大小,回调函数get处理具体数据相关的输入操作,其参数为数据存储位置的首地址。 +    返回值:输入了多少个元素。 +输出函数原型: +    int put_arr(void *ar, int sz, int n, int (*put)(void*)); +    参数:ar为输入数组的首地址、sz为数组每个单元大小,n为数组元素个数,回调函数put处理具体数据相关的输出操作,其参数为数据存储位置的首地址。 +    返回值:无意义。 +排序函数原型: +    int sort(void *ar, int sz, int n, int (*cmp)(void *, void*)); +    参数:ar为输入数组的首地址、sz为数组每个单元大小,n为数组元素个数,回调函数cmp处理具体数据相关的比较操作,其参数为待比较的两数据存储位置的首地址。 +    返回值:无意义。 + +相关的各种类型数据处理函数为 +    int类型:输入get_int()、输出put_int()、比较int_cmp() +    double类型:输入get_dbl()、输出put_dbl()、比较dbl_cmp() +    字符数组类型:输入get_str()、输出put_str()、比较str_cmp() +    日期类型:输入get_dte()、输出put_dte()、比较dte_cmp() +请根据题意完善这些函数的参数和返回值,并编写出来。 + +函数的调用格式见“Append Code”。 + + +## Input + +输入数据分为4组,每组以一个正整数n(n<100)开始,后接n个输入的数据。 +第一组为n个整数,要求按从大到小排列。 +第二组为n个实数,要求按从小到大排列。每个实数输出1位小数。 +第三组为n个小写字母组成的串,串长小于50,要求按规范序排列,即先按长度再按照字典序排列。 +第四组为n个日期,格式为“mm-dd-yyyy”即月日年,要求按日期先后顺序排列。 + + + +## Output + +输出为4行,每行对应一组输入数据,数据之间有一个空格分隔,行尾无空格。 +第一行为n个整数,第二行为n个实数,第三行为n个串,第四行为n个日期,格式为“yyyy-mm-dd”,年月日位数不足要补0。 + + +## Sample Input +``` +10 5 8 1 4 3 2 9 0 6 7 +6 0.2 2.1 1.6 6.3 3.5 5.4 +8 adc ad d ab abc b acb abb +5 10/10/2000 02/10/2012 01/10/2010 01/10/2012 02/01/2000 + +``` +## Sample Output +``` +9 8 7 6 5 4 3 2 1 0 +0.2 1.6 2.1 3.5 5.4 6.3 +b d ab ad abb abc acb adc +2000-02-01 2000-10-10 2010-01-10 2012-01-10 2012-02-10 + +``` + +## HINT + + +## Append Code +### append.c +```c +int main() +{ + int n; + int int_arr[MAX_SIZE]; + double dbl_arr[MAX_SIZE]; + struct date dte_arr[MAX_SIZE]; + char str_arr[MAX_SIZE][MAX_LEN]; + + n = get_arr(int_arr, sizeof(int), get_int); + sort(int_arr, sizeof(int), n, int_cmp); + put_arr(int_arr, sizeof(int), n, put_int); + + n = get_arr(dbl_arr, sizeof(double), get_dbl); + sort(dbl_arr, sizeof(double), n, dbl_cmp); + put_arr(dbl_arr, sizeof(double), n, put_dbl); + + n = get_arr(str_arr, sizeof(char) * MAX_LEN, get_str); + sort(str_arr, sizeof(char) * MAX_LEN, n, str_cmp); + put_arr(str_arr, sizeof(char) * MAX_LEN, n, put_str); + + n = get_arr(dte_arr, sizeof(struct date), get_dte); + sort(dte_arr, sizeof(struct date), n, dte_cmp); + put_arr(dte_arr, sizeof(struct date), n, put_dte); + + return 0; +} + +``` diff --git a/ProblemSet/2614/input b/ProblemSet/2614/input new file mode 100644 index 0000000..e69de29 diff --git a/ProblemSet/2614/output b/ProblemSet/2614/output new file mode 100644 index 0000000..e69de29 diff --git a/ProblemSet/2614/problem.md b/ProblemSet/2614/problem.md new file mode 100644 index 0000000..3c201e3 --- /dev/null +++ b/ProblemSet/2614/problem.md @@ -0,0 +1,34 @@ +# 结构体占用的存储空间 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +有如下定义的结构体类型: +         struct student +         { +             int serial; +             double score; +             char level; +             char name[14]; +         }; +请输出该结构体类型所需占用的存储空间大小(以字节为单位)。 + + +## Input +无。 + + +## Output +         输出是一个整数,即结构体student 类型占用的字节数。 + + +## Sample Input +``` + +``` +## Sample Output +``` + +``` + +## HINT diff --git a/ProblemSet/2615/input b/ProblemSet/2615/input new file mode 100644 index 0000000..e1cd85e --- /dev/null +++ b/ProblemSet/2615/input @@ -0,0 +1 @@ +183 547 29 diff --git a/ProblemSet/2615/output b/ProblemSet/2615/output new file mode 100644 index 0000000..2a81076 --- /dev/null +++ b/ProblemSet/2615/output @@ -0,0 +1 @@ +547 diff --git a/ProblemSet/2615/problem.md b/ProblemSet/2615/problem.md new file mode 100644 index 0000000..295a46e --- /dev/null +++ b/ProblemSet/2615/problem.md @@ -0,0 +1,28 @@ +# 第二个数 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +给出三个整数,输出其中的第二个数。 + + +## Input +输入为三个整数,两两整数之间用空格分开。 + + +## Output +输出为一个整数,是输入的第二个数。 + + +## Sample Input +``` +183 547 29 + +``` +## Sample Output +``` +547 + +``` + +## HINT diff --git a/ProblemSet/2616/input b/ProblemSet/2616/input new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/ProblemSet/2616/input @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/ProblemSet/2616/output b/ProblemSet/2616/output new file mode 100644 index 0000000..12a65a5 --- /dev/null +++ b/ProblemSet/2616/output @@ -0,0 +1 @@ +Monday \ No newline at end of file diff --git a/ProblemSet/2616/problem.md b/ProblemSet/2616/problem.md new file mode 100644 index 0000000..4774ea8 --- /dev/null +++ b/ProblemSet/2616/problem.md @@ -0,0 +1,34 @@ +# 星期几 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +根据输入的表示星期几的数字,对应输出它的英文名称。 +         1、星期一:Monday +         2、星期二:Tuesday +         3、星期三:Wednesday +         4、星期四:Thursday +         5、星期五:Friday +         6、星期六:Saturday +         7、星期日:Sunday +错误输入请输出:input error! + + +## Input +输入为一个整数。 + + +## Output +对应输出英文名称。 + + +## Sample Input +``` +1 +``` +## Sample Output +``` +Monday +``` + +## HINT diff --git a/ProblemSet/2617/input b/ProblemSet/2617/input new file mode 100644 index 0000000..a024861 --- /dev/null +++ b/ProblemSet/2617/input @@ -0,0 +1 @@ +3 0 8 7 5 9 \ No newline at end of file diff --git a/ProblemSet/2617/output b/ProblemSet/2617/output new file mode 100644 index 0000000..7813681 --- /dev/null +++ b/ProblemSet/2617/output @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/ProblemSet/2617/problem.md b/ProblemSet/2617/problem.md new file mode 100644 index 0000000..d2b84f1 --- /dev/null +++ b/ProblemSet/2617/problem.md @@ -0,0 +1,26 @@ +# 倒数第二个数 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +给出若干整数,输出其中的倒数第二个数。 + + +## Input +输入为若干(至少两个)整数,至EOF结束,两两整数之间用空格分开。 + + +## Output +输出为一个整数,是输入的倒数第二个数。 + + +## Sample Input +``` +3 0 8 7 5 9 +``` +## Sample Output +``` +5 +``` + +## HINT diff --git a/ProblemSet/2618/input b/ProblemSet/2618/input new file mode 100644 index 0000000..0281c42 --- /dev/null +++ b/ProblemSet/2618/input @@ -0,0 +1,2 @@ +communication +-10 10 diff --git a/ProblemSet/2618/output b/ProblemSet/2618/output new file mode 100644 index 0000000..84b136a --- /dev/null +++ b/ProblemSet/2618/output @@ -0,0 +1 @@ +[communicati] \ No newline at end of file diff --git a/ProblemSet/2618/problem.md b/ProblemSet/2618/problem.md new file mode 100644 index 0000000..ec25823 --- /dev/null +++ b/ProblemSet/2618/problem.md @@ -0,0 +1,28 @@ +# 截取字符串 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +对给定的一个字符串,截取其中一部分输出。 + + +## Input +输入为两行,第一行为一个字符串s,长度至少为1且不超过20个字符;第二行为两个整数p、q,满足p<=q。 + + +## Output +输出s中下标从p到q的那部分,且p或q在s下标范围外的部分不会产生输出。若s[p]到s[q]不产生任何输出,则仅输出“[]”。 + + +## Sample Input +``` +communication +-10 10 + +``` +## Sample Output +``` +[communicati] +``` + +## HINT diff --git a/ProblemSet/2619/input b/ProblemSet/2619/input new file mode 100644 index 0000000..5ec2cb8 --- /dev/null +++ b/ProblemSet/2619/input @@ -0,0 +1,9 @@ +5 +13 66 53 89 55 +11 72 61 62 46 +90 10 38 10 55 +95 20 43 27 19 +60 12 66 16 96 +1 1 3 2 +0 0 4 0 +2 1 2 4 diff --git a/ProblemSet/2619/output b/ProblemSet/2619/output new file mode 100644 index 0000000..25267f8 --- /dev/null +++ b/ProblemSet/2619/output @@ -0,0 +1,3 @@ +244 +269 +113 diff --git a/ProblemSet/2619/problem.md b/ProblemSet/2619/problem.md new file mode 100644 index 0000000..96a40dd --- /dev/null +++ b/ProblemSet/2619/problem.md @@ -0,0 +1,39 @@ +# 矩阵元素求和 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +输入一个n阶方阵a,输出其部分元素之和。 + + +## Input +输入为两部分。第一部分第一行为一个整数n(n<=10),后接n行n列个数字,表示n阶方阵。第二部分为若干行,至EOF结束,每行四个整数,前两个整数为求和区域左上角元素坐标p、q,后两个为右下角坐标r、s。输入数据保证p、q、r、s均在方阵的有效下标范围内。 + + + +## Output +每行输出一个整数m,对应输入第二部分的每一行,m为方阵a[p][q]~a[r][s] 区域内所有元素之和。 + + +## Sample Input +``` +5 +13 66 53 89 55 +11 72 61 62 46 +90 10 38 10 55 +95 20 43 27 19 +60 12 66 16 96 +1 1 3 2 +0 0 4 0 +2 1 2 4 + +``` +## Sample Output +``` +244 +269 +113 + +``` + +## HINT diff --git a/ProblemSet/2620/input b/ProblemSet/2620/input new file mode 100644 index 0000000..e8835b7 --- /dev/null +++ b/ProblemSet/2620/input @@ -0,0 +1 @@ +15 10 20 \ No newline at end of file diff --git a/ProblemSet/2620/output b/ProblemSet/2620/output new file mode 100644 index 0000000..12cf442 --- /dev/null +++ b/ProblemSet/2620/output @@ -0,0 +1 @@ +20 diff --git a/ProblemSet/2620/problem.md b/ProblemSet/2620/problem.md new file mode 100644 index 0000000..325cc90 --- /dev/null +++ b/ProblemSet/2620/problem.md @@ -0,0 +1,45 @@ +# max()函数(Append Code) +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +编写一个函数max(),返回三个参数中的最大整数。 + +max()函数的调用格式见append.c + + + +## Input +输入为三个整数。 + + + +## Output +输出为三个整数中的最大值。 + + + +## Sample Input +``` +15 10 20 +``` +## Sample Output +``` +20 + +``` + +## HINT + + +## Append Code +### append.c +```c +int main() +{ + int a, b, c; + scanf("%d %d %d", &a, &b, &c); + printf("%d\n", max(a, b, c)); +} + +``` diff --git a/ProblemSet/2621/input b/ProblemSet/2621/input new file mode 100644 index 0000000..97e3504 --- /dev/null +++ b/ProblemSet/2621/input @@ -0,0 +1 @@ +110 \ No newline at end of file diff --git a/ProblemSet/2621/output b/ProblemSet/2621/output new file mode 100644 index 0000000..13d8395 --- /dev/null +++ b/ProblemSet/2621/output @@ -0,0 +1 @@ +011 \ No newline at end of file diff --git a/ProblemSet/2621/problem.md b/ProblemSet/2621/problem.md new file mode 100644 index 0000000..c2b84ef --- /dev/null +++ b/ProblemSet/2621/problem.md @@ -0,0 +1,50 @@ +# 递归求倒序数二(Append Code) +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +         给出一个无符号整数n<264,求出n的倒序数字。 +  +         请根据“Append Code”完成程序。append.c中将n输入到一个字符串num中,调用了一个函数rev (num, i),用来倒转输出数字n,其中i为串的下标。用C语言或C++编写自定义类型和函数实现,函数的原型为: +                  int rev(char s[], int i); +         函数的调用格式见“Append Code”。 +         ----------------------------------------------------------------------------- +         Invalid Word(禁用单词)错误:在解决这个题目时,某些关键词是不允许被使用的。如果提交的程序中包含了下列的关键词之一,就会产生这个错误。 + +         被禁用的关键字:for, while, do, break, continue, goto。 + + +## Input +         输入一个小于264的无符号整数n。 + + + + + +## Output +         输出n的倒序数。 + + +## Sample Input +``` +110 +``` +## Sample Output +``` +011 +``` + +## HINT + + +## Append Code +### append.c +```c +int main() +{ + char num[MAX_LEN]; + gets(num); + rev(num, 0); +} + +``` diff --git a/ProblemSet/2622/input b/ProblemSet/2622/input new file mode 100644 index 0000000..325ceda --- /dev/null +++ b/ProblemSet/2622/input @@ -0,0 +1,3 @@ +3 +2 3 2 +2 diff --git a/ProblemSet/2622/output b/ProblemSet/2622/output new file mode 100644 index 0000000..d8263ee --- /dev/null +++ b/ProblemSet/2622/output @@ -0,0 +1 @@ +2 \ No newline at end of file diff --git a/ProblemSet/2622/problem.md b/ProblemSet/2622/problem.md new file mode 100644 index 0000000..4de4730 --- /dev/null +++ b/ProblemSet/2622/problem.md @@ -0,0 +1,53 @@ +# 数组元素计数 (Append Code) +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +输出一个数组中与指定数字相同的元素的个数。 +----------------------------------------------------------------------------- + 结合“Append Code”中的代码,编写以下函数: + 原型:int count_array(int a[], int n, int v); + 功能:从数组a[]中统计与v相同的元素个数并返回,其中n是数组a[]的长度。 + + +## Input +输入为三行整数,第一行为n,表示数组长度(n<=100);第二行为n个整数;第三行为一个整数,为指定数字m。 + + + + + +## Output +输出为n个数中与m相同的数的个数。 + + +## Sample Input +``` +3 +2 3 2 +2 + +``` +## Sample Output +``` +2 +``` + +## HINT + + +## Append Code +### append.c +```c +int main() +{ + int a[100], i, n, val, cnt; + scanf("%d", &n); + for(i = 0; i < n; i++) + scanf("%d", &a[i]); + scanf("%d", &val); + cnt = count_array(a, n, val); + printf("%d\n", cnt); +} + +``` diff --git a/ProblemSet/2623/input b/ProblemSet/2623/input new file mode 100644 index 0000000..b97e752 --- /dev/null +++ b/ProblemSet/2623/input @@ -0,0 +1 @@ +abcde1357 diff --git a/ProblemSet/2623/output b/ProblemSet/2623/output new file mode 100644 index 0000000..1c51e39 --- /dev/null +++ b/ProblemSet/2623/output @@ -0,0 +1,2 @@ +ace37 +bd15 diff --git a/ProblemSet/2623/problem.md b/ProblemSet/2623/problem.md new file mode 100644 index 0000000..6c3c7dc --- /dev/null +++ b/ProblemSet/2623/problem.md @@ -0,0 +1,51 @@ +# 字符串的分隔 (Append Code) +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +将输入的一个字符串s中按下标分隔为两个串,一个由奇数下标的字符(s[1],s[3],s[5]…)按顺序的组成,一个由偶数下标的字符(s[0],s[2],s[4]…)按顺序的组成。 + ----------------------------------------------------------------------------- + 编写一个函数str_sep(): + 原型:void  str_sep(char s[],  char t[],  char r[]); + 功能:把串r中的字符按奇偶数分隔为s、t,偶数下标的放入s中,奇数下标的放入t中。 + 函数的调用格式见“Append Code”。 + + +## Input +输入为一个串s。输入最少为一个字符,最多不会超过100个字符。 + + + +## Output +输出为转换后的串。 + + +## Sample Input +``` +abcde1357 + +``` +## Sample Output +``` +ace37 +bd15 + +``` + +## HINT + + +## Append Code +### append.c +```c +int main() +{ + char r[101], s[101], t[101]; + gets(r); + str_sep(s, t, r); + puts(s); + puts(t); + return 0; +} + +``` diff --git a/ProblemSet/2624/input b/ProblemSet/2624/input new file mode 100644 index 0000000..1e2c8ac --- /dev/null +++ b/ProblemSet/2624/input @@ -0,0 +1,6 @@ +5 +12 0 30 +12 3 30 +11 1 30 +11 3 20 +12 3 20 diff --git a/ProblemSet/2624/output b/ProblemSet/2624/output new file mode 100644 index 0000000..84953e1 --- /dev/null +++ b/ProblemSet/2624/output @@ -0,0 +1,5 @@ +11:01:30 +11:03:20 +12:00:30 +12:03:20 +12:03:30 diff --git a/ProblemSet/2624/problem.md b/ProblemSet/2624/problem.md new file mode 100644 index 0000000..83a589a --- /dev/null +++ b/ProblemSet/2624/problem.md @@ -0,0 +1,62 @@ +# 时间的顺序 (Append Code) +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +输入不超过100个(24小时制)时间,把它们按从前到后进行排序。 + ----------------------------------------------------------------------------- + 至少编写三个函数完成程序: + 原型:int get_time(struct time tm[]); + 功能:按格式从输入读取若干时间存入结构体数组tm[]中,返回值为实际输入的时间个数。 + 原型:int sort_time(struct time tm[], int n); + 功能:将结构体数组tm中的时间按从小到大排序。 + 原型:int put_time(struct time tm[], int n); + 功能:将结构体数组tm中的时间按顺序输出,格式见样例。 + 函数的调用格式见“Append Code”,结构体“struct time”的类型定义根据“Append Code”自行给出。 + + +## Input +输入为两部分,第一部分为整数n,n<=100,第二部分为n行,每行三行个整数,表示时间的小时、分钟、秒。 + + + +## Output +输出为n个从小到大的时间,格式为”hh:mm:ss”,时分秒均输出2位,不足前补0。 + + +## Sample Input +``` +5 +12 0 30 +12 3 30 +11 1 30 +11 3 20 +12 3 20 + +``` +## Sample Output +``` +11:01:30 +11:03:20 +12:00:30 +12:03:20 +12:03:30 + +``` + +## HINT + + +## Append Code +### append.c +```c +int main() +{ + struct time tm[100]; + int i, n; + n = get_time(tm); + sort_time(tm, n); + put_time(tm, n); +} + +``` diff --git a/ProblemSet/2625/input b/ProblemSet/2625/input new file mode 100644 index 0000000..fae0303 --- /dev/null +++ b/ProblemSet/2625/input @@ -0,0 +1,4 @@ +0 +1 +2 +3 diff --git a/ProblemSet/2625/output b/ProblemSet/2625/output new file mode 100644 index 0000000..69d8a63 --- /dev/null +++ b/ProblemSet/2625/output @@ -0,0 +1,4 @@ +0 +1 +1 +2 diff --git a/ProblemSet/2625/problem.md b/ProblemSet/2625/problem.md new file mode 100644 index 0000000..764b797 --- /dev/null +++ b/ProblemSet/2625/problem.md @@ -0,0 +1,34 @@ +# 有多少个1 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +给出一个十进制非负整数,求其二进制表示中有多少个1。 + + +## Input +输入为若干int范围内的整数,每行一个为n至EOF结束。 + + + +## Output +输出对应输入每个n的二进制中1的个数。 + +## Sample Input +``` +0 +1 +2 +3 + +``` +## Sample Output +``` +0 +1 +1 +2 + +``` + +## HINT diff --git a/ProblemSet/2675/input b/ProblemSet/2675/input new file mode 100644 index 0000000..42cc919 --- /dev/null +++ b/ProblemSet/2675/input @@ -0,0 +1,3 @@ +10 +11 +101 diff --git a/ProblemSet/2675/output b/ProblemSet/2675/output new file mode 100644 index 0000000..9a8e1d5 --- /dev/null +++ b/ProblemSet/2675/output @@ -0,0 +1,3 @@ +No. +Yes. +Yes. diff --git a/ProblemSet/2675/problem.md b/ProblemSet/2675/problem.md new file mode 100644 index 0000000..e6f27b7 --- /dev/null +++ b/ProblemSet/2675/problem.md @@ -0,0 +1,33 @@ +# 回文数字 +Time Limit: 1 Sec  Memory Limit: 16 MB + + +## Description +“回文(Palindrome)”是指一个串和它的倒序串完全一样,例如“文言文”、“上海在海上”、“妈妈爱我,我爱妈妈”就是回文。 +接下来,你要编写一个程序来判断一个数字是不是回文数字。 + + +## Input +输入为多行,至EOF结束。每行包含一个int范围内的整数k。 + + +## Output +每行输出与输入相对应,若该行输入的数字是回文,即输出“Yes.”;否则输出“No.”。 + + +## Sample Input +``` +10 +11 +101 + +``` +## Sample Output +``` +No. +Yes. +Yes. + +``` + +## HINT diff --git a/ProblemSet/2676/input b/ProblemSet/2676/input new file mode 100644 index 0000000..ed18eea --- /dev/null +++ b/ProblemSet/2676/input @@ -0,0 +1,11 @@ +12 +11 +10 +9 +8 +7 +6 +5 +4 +3 +2 diff --git a/ProblemSet/2676/output b/ProblemSet/2676/output new file mode 100644 index 0000000..bf0d87a --- /dev/null +++ b/ProblemSet/2676/output @@ -0,0 +1 @@ +4 \ No newline at end of file diff --git a/ProblemSet/2676/problem.md b/ProblemSet/2676/problem.md new file mode 100644 index 0000000..59979c4 --- /dev/null +++ b/ProblemSet/2676/problem.md @@ -0,0 +1,37 @@ +# 数字统计二 +Time Limit: 1 Sec  Memory Limit: 128 MB + + +## Description +给出一些数字,统计出现最多的数字0~9的次数 + + +## Input +输入为多行(1~500000行),至EOF结束。每行包含一个数字k,0<=k<=200000 + + +## Output +输出出现次数最多的数字0~9的个数。 + + +## Sample Input +``` +12 +11 +10 +9 +8 +7 +6 +5 +4 +3 +2 + +``` +## Sample Output +``` +4 +``` + +## HINT diff --git a/ProblemSet/2677/input b/ProblemSet/2677/input new file mode 100644 index 0000000..9a03714 --- /dev/null +++ b/ProblemSet/2677/input @@ -0,0 +1 @@ +10 \ No newline at end of file diff --git a/ProblemSet/2677/output b/ProblemSet/2677/output new file mode 100644 index 0000000..58356fa --- /dev/null +++ b/ProblemSet/2677/output @@ -0,0 +1 @@ +2.7182818011 \ No newline at end of file diff --git a/ProblemSet/2677/problem.md b/ProblemSet/2677/problem.md new file mode 100644 index 0000000..29b1d20 --- /dev/null +++ b/ProblemSet/2677/problem.md @@ -0,0 +1,26 @@ +# 求e的近似值 +Time Limit: 1 Sec  Memory Limit: 128 MB + + +## Description +利用公式,求出e的近似值,要求保留小数点后10位 + + +## Input +输入为一个整数n,1<=n<=15,表示计算e时累加到 + + +## Output +输出只有一行,为计算出来e的近似值。 + + +## Sample Input +``` +10 +``` +## Sample Output +``` +2.7182818011 +``` + +## HINT diff --git a/ProblemSet/2678/input b/ProblemSet/2678/input new file mode 100644 index 0000000..9a03714 --- /dev/null +++ b/ProblemSet/2678/input @@ -0,0 +1 @@ +10 \ No newline at end of file diff --git a/ProblemSet/2678/output b/ProblemSet/2678/output new file mode 100644 index 0000000..58356fa --- /dev/null +++ b/ProblemSet/2678/output @@ -0,0 +1 @@ +2.7182818011 \ No newline at end of file diff --git a/ProblemSet/2678/problem.md b/ProblemSet/2678/problem.md new file mode 100644 index 0000000..d0fc94f --- /dev/null +++ b/ProblemSet/2678/problem.md @@ -0,0 +1,30 @@ +# 递归求e的近似值 +Time Limit: 1 Sec  Memory Limit: 2 MB + + +## Description +利用公式,求出e的近似值,要求保留小数点后10位 + +----------------------------------------------------------------------------- +Invalid Word(禁用单词)错误:在解决这个题目时,某些关键词是不允许被使用的。如果提交的程序中包含了下列的关键词之一,就会产生这个错误。 +被禁用的关键字:for, while, do, break, continue, goto。 + + +## Input +输入为一个整数n,1<=n<=15,表示计算e时累加到。 + + +## Output +输出只有一行,为计算出来e的近似值。 + + +## Sample Input +``` +10 +``` +## Sample Output +``` +2.7182818011 +``` + +## HINT diff --git a/ProblemSet/2679/input b/ProblemSet/2679/input new file mode 100644 index 0000000..7267d16 --- /dev/null +++ b/ProblemSet/2679/input @@ -0,0 +1,7 @@ +1 2 +2 3 +8 10 +1 11 +50 100 +900 1000 +499900 500000 diff --git a/ProblemSet/2679/output b/ProblemSet/2679/output new file mode 100644 index 0000000..c4bd540 --- /dev/null +++ b/ProblemSet/2679/output @@ -0,0 +1,7 @@ +1 +2 +0 +5 +10 +14 +7 diff --git a/ProblemSet/2679/problem.md b/ProblemSet/2679/problem.md new file mode 100644 index 0000000..94e7bb9 --- /dev/null +++ b/ProblemSet/2679/problem.md @@ -0,0 +1,40 @@ +# 有多少个素数 +Time Limit: 2 Sec  Memory Limit: 128 MB + + +## Description +求区间m~n之间的素数,其中m,n为整数,且0<=m<=n<=10000000。 + + +## Input +输入多行,到EOF结束。每行为一个测试用例,两个整数m和n。总测试用例数不超过1000个。 + + +## Output +输出每行与输入对应,为m~n之间素数的个数。 + + +## Sample Input +``` +1 2 +2 3 +8 10 +1 11 +50 100 +900 1000 +499900 500000 + +``` +## Sample Output +``` +1 +2 +0 +5 +10 +14 +7 + +``` + +## HINT diff --git a/QuestionAns/peerin/1001.c b/QuestionAns/peerin/1001.c new file mode 100644 index 0000000..a134196 --- /dev/null +++ b/QuestionAns/peerin/1001.c @@ -0,0 +1,15 @@ +#include + +int main(){ +printf("Hello Da_min,\nHello Er_min,\nHello Xiao_ming!\n"); +return 0; +} +/************************************************************** + Problem: 1001 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:744 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1002.c b/QuestionAns/peerin/1002.c new file mode 100644 index 0000000..aa753b6 --- /dev/null +++ b/QuestionAns/peerin/1002.c @@ -0,0 +1,18 @@ +#include + +int main(){ +int x,y; +scanf("x = %d, y = %d",&x,&y); +printf("x + y : %d\nx - y : %d\nx * y : %d\nx / y quotient: %d, remainder: %d\nx ^ 2 : %d\ny ^ 3 : %d",x+y,x-y,x*y,x/y,x%y,x*x,y*y*y); +return 0; +} + +/************************************************************** + Problem: 1002 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1003.c b/QuestionAns/peerin/1003.c new file mode 100644 index 0000000..dd0f092 --- /dev/null +++ b/QuestionAns/peerin/1003.c @@ -0,0 +1,18 @@ +#include +#define PI 3.14 + +int main(){ +double r; +scanf("%lf",&r); +printf("Area: %f\nPerimeter: %f",PI*r*r,2*PI*r); +return 0; +} +/************************************************************** + Problem: 1003 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1004.c b/QuestionAns/peerin/1004.c new file mode 100644 index 0000000..17aeee1 --- /dev/null +++ b/QuestionAns/peerin/1004.c @@ -0,0 +1,18 @@ +#include + +int main(){ +int x,y,z; +scanf("%d %d %d",&x,&y,&z); +printf("%.3f",(x+y+z)/3.0); +return 0; +} + +/************************************************************** + Problem: 1004 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1005.c b/QuestionAns/peerin/1005.c new file mode 100644 index 0000000..9eaffaf --- /dev/null +++ b/QuestionAns/peerin/1005.c @@ -0,0 +1,19 @@ +#include + +int main(){ + double meiyuan,ouyuan,riyuan; + int waibi,rmb; + scanf("%lf %lf %lf\n%d\n%d",&meiyuan,&ouyuan,&riyuan,&waibi,&rmb); + printf("%.2f %.2f %.2f\n%.2f %.2f %.2f",meiyuan/100*waibi,ouyuan/100*waibi,riyuan/100*waibi,rmb/(meiyuan/100),rmb/(ouyuan/100),rmb/(riyuan/100)); +return 0; +} + +/************************************************************** + Problem: 1005 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1006.c b/QuestionAns/peerin/1006.c new file mode 100644 index 0000000..cd63a99 --- /dev/null +++ b/QuestionAns/peerin/1006.c @@ -0,0 +1,20 @@ +#include + +int main(){ + char a,b,c; + scanf("%c%c%c",&a,&b,&c); + printf("%03d %03o %03x\n",a,a,a); + printf("%03d %03o %03x\n",b,b,b); + printf("%03d %03o %03x\n",c,c,c); + return 0; +} + +/************************************************************** + Problem: 1006 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1007.c b/QuestionAns/peerin/1007.c new file mode 100644 index 0000000..f587547 --- /dev/null +++ b/QuestionAns/peerin/1007.c @@ -0,0 +1,19 @@ +#include + +int main(){ + int num; + scanf("%d",&num); + printf("%s",num%2==0 ? "even" : "odd"); + + return 0; +} + +/************************************************************** + Problem: 1007 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1008.c b/QuestionAns/peerin/1008.c new file mode 100644 index 0000000..ce724e5 --- /dev/null +++ b/QuestionAns/peerin/1008.c @@ -0,0 +1,23 @@ +#include + +int main(){ + int int1; + double double1; + scanf("%d",&int1); + scanf("%lf",&double1); + printf("%d\n",int1<0?-int1:int1); + printf("%g\n",double1<0?-double1:double1); + + + return 0; +} + +/************************************************************** + Problem: 1008 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1009.c b/QuestionAns/peerin/1009.c new file mode 100644 index 0000000..aac857b --- /dev/null +++ b/QuestionAns/peerin/1009.c @@ -0,0 +1,21 @@ +#include + +int main(){ + int m,n,x; + scanf("%d %d %d",&m,&n,&x); + int sum = m*x; + double total = sum >= n ? sum*0.88 : sum; + printf("%.2f",total); + return 0; + +} + +/************************************************************** + Problem: 1009 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1010.c b/QuestionAns/peerin/1010.c new file mode 100644 index 0000000..6130fee --- /dev/null +++ b/QuestionAns/peerin/1010.c @@ -0,0 +1,18 @@ +#include + +int main(){ + int n; + scanf("%d",&n); + printf("%s",n%4==0&&n%100!=0||n%400==0?"Yes":"No"); + return 0; +} + +/************************************************************** + Problem: 1010 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1012.c b/QuestionAns/peerin/1012.c new file mode 100644 index 0000000..db9b368 --- /dev/null +++ b/QuestionAns/peerin/1012.c @@ -0,0 +1,34 @@ +#include +int is_(int num){ + int is_or_not; + int hundred,ten,several; + hundred = num/100; + ten = (num-hundred*100)/10; + several = num - hundred*100 - ten*10; + if(hundred*hundred*hundred+ten*ten*ten+several*several*several==num) + is_or_not = 1; + else + is_or_not = 0; + + + return is_or_not; +} +int main(){ + int num; + scanf("%d",&num); + printf("%s",is_(num)?"YES":"NO"); + + + + return 0; +} + +/************************************************************** + Problem: 1012 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1013.c b/QuestionAns/peerin/1013.c new file mode 100644 index 0000000..0ccbee9 --- /dev/null +++ b/QuestionAns/peerin/1013.c @@ -0,0 +1,36 @@ +#include +int find_max(int change,int face){ + int max=-1; + int temp; + do{ + max++; +temp = change - max*face; + + }while(temp>=face); + return max; +} + +int main(){ + int x; + scanf("%d",&x); + int change = 100 - x; + int d20 = find_max(change,20); + int d10 = find_max(change-20*d20,10); + int d5 = find_max(change-20*d20-10*d10,5); + int d1 = find_max(change-20*d20-10*d10-5*d5,1); + printf("$20 bills: %d\n",d20); + printf("$10 bills: %d\n",d10); + printf(" $5 bills: %d\n",d5); + printf(" $1 bills: %d",d1); + return 0; +} + +/************************************************************** + Problem: 1013 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1014.c b/QuestionAns/peerin/1014.c new file mode 100644 index 0000000..5ae8ac5 --- /dev/null +++ b/QuestionAns/peerin/1014.c @@ -0,0 +1,36 @@ +#include + +int main(){ + char a[50],b[50]; + int i2 = 0; + int zero_flag = 0; + scanf("%s",a); + for(int i = 0;i < 50;i++){ + if(a[i]=='0'&&zero_flag==0){ + zero_flag = 1; + ; + }else if(a[i]=='\0'){ + b[i2] = a[i]; + break; + } + else if(a[i]=='('||a[i]==')'||a[i]=='-'){ + ; + } + else{ + b[i2] = a[i]; + i2++; + } + } + printf("0086%s",b); + return 0; +} + +/************************************************************** + Problem: 1014 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1015.c b/QuestionAns/peerin/1015.c new file mode 100644 index 0000000..644b4cd --- /dev/null +++ b/QuestionAns/peerin/1015.c @@ -0,0 +1,38 @@ +#include +int main(){ +long long x; +scanf("%lld",&x); +unsigned long long y = (1.0+x)*x/2.0; +printf("%llu",y); +return 0; +} + + + + + + + + + + + + + + + + + + + + + +/************************************************************** + Problem: 1015 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1016.c b/QuestionAns/peerin/1016.c new file mode 100644 index 0000000..020cac9 --- /dev/null +++ b/QuestionAns/peerin/1016.c @@ -0,0 +1,20 @@ +#include +#include + +int main() +{ +double n; +scanf("%lf",&n); + + printf("%d",(int)log2(n)); + return 0; +} +/************************************************************** + Problem: 1016 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:756 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1017.c b/QuestionAns/peerin/1017.c new file mode 100644 index 0000000..7f82595 --- /dev/null +++ b/QuestionAns/peerin/1017.c @@ -0,0 +1,42 @@ +#include +#include +int main(){ +char *s1,*s2; +s1 = (char *)malloc(sizeof(char)*27); +s2 = (char *)malloc(sizeof(char)*27); +//scanf("%s",s1); +//scanf("%s",s2); +gets(s1); +gets(s2); +int len1,len2; +for(int i = 0;i < 27;++i){ +if(s1[i] == '\0'){ +len1 = i+1; +break; +} +} +for(int i = 0;i < 27;++i){ +if(s2[i] == '\0'){ +len2 = i+1; +break; +} +} +if(len1<=len2){ +printf("%s\n%s",s2,s1); +}else{ + +printf("%s\n%s",s1,s2); +} +free(s1); +free(s2); +return 0; +} +/************************************************************** + Problem: 1017 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1018.c b/QuestionAns/peerin/1018.c new file mode 100644 index 0000000..d356ee5 --- /dev/null +++ b/QuestionAns/peerin/1018.c @@ -0,0 +1,31 @@ +#include + + +int main(){ + int a[3]; + for(int i = 0;i < 3;i++){ + scanf("%d",&a[i]); + } + for(int i = 0;i < 3;i++){ + for(int j = i;j < 3;j++){ + if(a[j] +int find_number(int m,int n){ + int MAX = 10000; + int temp; + for(int i = 1;i temp) + break; + if(temp == n*j) + return temp; + + } + } +} + +int main(){ + int k,m,n; + int res[101]; + int count = 0; + scanf("%d%d%d",&k,&m,&n); + int m_n = m%n==0 ? m : n%m==0 ? n : find_number(m,n); + // printf("%d\n",m_n); + for(int i = 1;i<=k;++i){ + if((i%m==0||i%n==0)&&(i%m_n!=0)){ + res[count] = i; + count++; + } + } + for(int i = 0;i < count;++i){ + printf("%d",res[i]); + if(i != count-1) + printf(" "); + + + } + + return 0; +} + +/************************************************************** + Problem: 1019 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1020.c b/QuestionAns/peerin/1020.c new file mode 100644 index 0000000..5b7e597 --- /dev/null +++ b/QuestionAns/peerin/1020.c @@ -0,0 +1,24 @@ +#include + +int main(){ + int a[100],b[100]; + int i = 0; + for(;i < 100;i++){ + if(scanf("%d %d",a + i,b + i) == EOF) + break; + } + for(int i2 = 0;i2 < i;i2++){ + printf("%d\n",*(a+i2)+*(b+i2)); + } + return 0; +} + +/************************************************************** + Problem: 1020 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1021.c b/QuestionAns/peerin/1021.c new file mode 100644 index 0000000..527b362 --- /dev/null +++ b/QuestionAns/peerin/1021.c @@ -0,0 +1,25 @@ +#include + +int main(){ + int N; + scanf("%d",&N); + int a[N],b[N]; + for(int i =0 ;i + +int main(){ + int a[100],b[100]; + int i = 0; + for(;i < 100;i++){ + scanf("%d %d",a + i,b + i); + if(a[i] == 0 && b[i] == 0) + break; + } + for(int i2 = 0;i2 < i;i2++){ + printf("%d\n",*(a+i2)+*(b+i2)); + } + return 0; +} + +/************************************************************** + Problem: 1022 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1023.c b/QuestionAns/peerin/1023.c new file mode 100644 index 0000000..c0993d0 --- /dev/null +++ b/QuestionAns/peerin/1023.c @@ -0,0 +1,24 @@ +#include + +int main(){ + int a[100],b[100]; + int i = 0; + for(;i < 100;i++){ + if(scanf("%d %d",a + i,b + i) == EOF) + break; + } + for(int i2 = 0;i2 < i;i2++){ + printf("%d\n\n",*(a+i2)+*(b+i2)); + } + return 0; +} + +/************************************************************** + Problem: 1023 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1024.c b/QuestionAns/peerin/1024.c new file mode 100644 index 0000000..cd53b9a --- /dev/null +++ b/QuestionAns/peerin/1024.c @@ -0,0 +1,33 @@ +#include + +int main(){ + int n; + scanf("%d",&n); + int number[n]; + + for(int i = 0;i < n;++i){ + scanf("%d",&number[i]); + } + int max = number[0]; + int min = number[0]; + + for(int i = 0;i < n;++i){ + if(number[i]>=max) + max = number[i]; + if(number[i]<=min) + min = number[i]; + + } + printf("The maximum number is %d.\nThe minimum number is %d.",max,min); + return 0; +} + +/************************************************************** + Problem: 1024 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1025.c b/QuestionAns/peerin/1025.c new file mode 100644 index 0000000..ecb71c0 --- /dev/null +++ b/QuestionAns/peerin/1025.c @@ -0,0 +1,68 @@ +#include +void func(int score){ + + if(score < 0||score>100) + printf("Error\n"); + else{ + score = score / 10; + switch(score){ + case 0: + printf("Failing\n"); + break; + case 1: + printf("Failing\n"); + break; + case 2: + printf("Failing\n"); + break; + case 3: + printf("Failing\n"); + break; + case 4: + printf("Failing\n"); + break; + case 5: + printf("Failing\n"); + break; + case 6: + printf("Pass\n"); + break; + case 7: + printf("Average\n"); + break; + case 8: + printf("Good\n"); + break; + case 9: + printf("Excellent\n"); + break; + case 10: + printf("Excellent\n"); + break; + default: + printf("Error\n"); + } + + } + +} +int main(){ + int score; + while( scanf("%d",&score)!=EOF){ + func(score); + } + + + + return 0; +} + +/************************************************************** + Problem: 1025 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1027.c b/QuestionAns/peerin/1027.c new file mode 100644 index 0000000..231c1f8 --- /dev/null +++ b/QuestionAns/peerin/1027.c @@ -0,0 +1,37 @@ +#include +int judge(int m){ + if(m == 0)return 0; + for(int i = 2;i +#include +#include +void c_f(){ + int low,high; + double step; + scanf("%d",&low); + scanf("%d",&high); + scanf("%lf",&step); + if(low>high){ + int temp = high; + high = low; + low = temp; + } + + printf("%4c -> %4c\n",'C','F'); + for(double i = low;i %5.1f\n",i,i/(5.0/9.0)+32); + } +} +void f_c(){ + int low,high; + double step; + scanf("%d",&low); + scanf("%d",&high); + scanf("%lf",&step); + if(low>high){ + int temp = high; + high = low; + low = temp; + } + printf("%4c -> %4c\n",'F','C'); + for(double i = low;i %5.1f\n",i,(i-32)*(5.0/9.0)); + } +} +int main(){ + char a,b; + scanf("%c->%c",&a,&b); + if(a=='F'&&b=='C'){ + f_c(); + }else if(a=='C'&&b=='F'){ + c_f(); + } + return 0; +} + +/************************************************************** + Problem: 1028 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1041.c b/QuestionAns/peerin/1041.c new file mode 100644 index 0000000..5d9b6f7 --- /dev/null +++ b/QuestionAns/peerin/1041.c @@ -0,0 +1,84 @@ +#include + +int abs(int a){ + + return a<=0?-a:a; + + } +int min(int a,int b){ + + return ab?a:b; + + +} +/* int gcd(int a,int b){ */ + +/* if(a==0) */ +/* return b; */ +/* else if(b == 0) */ +/* return a; */ +/* else { */ +/* return gcd(min(a,b),abs(a-b)); */ +/* } */ +/* } */ +int gcd(int a, int b){ + int tmpp = a; + tmpp= max(a,b); + b = min(a,b); + a = tmpp; + int temp = 2147483647; + loop: + for(;temp>=b;){ + temp = a % b; + if(temp==0) + return b; +} + int tmp = b; + b = temp; + a = tmp; + temp = 2147483647; + goto loop; + +} + +int lcm(int a,int b){ + + + return a/gcd(a,b)*b; + +} + +int main(){ + int a, b; + // printf("%d",gcd(1,1)); + while(scanf("%d %d",&a,&b)!=EOF){ + if(a == 0 && b == 0){ + printf("%d %d\n",0,0); + } + else if(a == 0){ + printf("%d %d\n",b,0); + }else if(b==0){ + printf("%d %d\n",a,0); + } + else + printf("%d %d\n",gcd(a,b),lcm(a,b)); + } + + + return 0; +} + +/************************************************************** + Problem: 1041 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1042.c b/QuestionAns/peerin/1042.c new file mode 100644 index 0000000..4952f3c --- /dev/null +++ b/QuestionAns/peerin/1042.c @@ -0,0 +1,25 @@ +#include +int main(){ + int sum=0; + int a; + int N; + while(scanf("%d",&N)!=EOF){ + sum = 0; + for(int i = 0;i +int main(){ + int sum=0; + int a; + int M,N; + scanf("%d",&M); + for(int i = 0;i < M;++i){ + sum = 0; + scanf("%d",&N); + for(int j = 0;j +int main(){ + int sum=0; + int a; + int N=0; + while(scanf("%d",&N)&&N!=0){ + sum = 0; + for(int i = 0;i +int main(){ + int sum=0; + int a; + int M,N; + scanf("%d",&M); + for(int i = 0;i < M;++i){ + sum = 0; + scanf("%d",&N); + for(int j = 0;j + +int main() +{ + int a_cock_money, b_hen_money, c_chick_num, d_chick_money, m_money, n_num, x_cock, y_hen, z_chick, f=0; + scanf("COCK,HEN,CHICK,MONEY,CHICKS"); + while(scanf("%d,%d,%d/%d,%d,%d",&a_cock_money,&b_hen_money,&c_chick_num,&d_chick_money,&m_money,&n_num) != EOF) + { + f=0; + + for(x_cock=0;x_cock<=m_money/a_cock_money;x_cock++) + { + + y_hen=(m_money*d_chick_money-c_chick_num*n_num+x_cock*(c_chick_num-a_cock_money*d_chick_money))/(b_hen_money*d_chick_money-c_chick_num); + z_chick=n_num-x_cock-y_hen; + if(x_cock>=0&&y_hen>=0&&z_chick>=0&&a_cock_money*d_chick_money*x_cock+b_hen_money*d_chick_money*y_hen+c_chick_num*z_chick==d_chick_money*m_money) + { + if(f==0) + printf("COCKS,HENS,CHICKS\n"); + f=1; + printf("%d,%d,%d\n", x_cock, y_hen, z_chick); + } + } + if(f==0) + printf("Cannot buy!\n"); + printf("\n"); + + } + return 0; +} + +/************************************************************** + Problem: 1046 + User: 202211070518 + Language: C + Result: Accepted + Time:12 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1047.c b/QuestionAns/peerin/1047.c new file mode 100644 index 0000000..12f420c --- /dev/null +++ b/QuestionAns/peerin/1047.c @@ -0,0 +1,27 @@ +#include +/* unsigned long long shengun(unsigned long long n){ */ +/* return (n-1llu)*1000llu+471llu; */ +/* } */ +int main(){ + + unsigned long long n; + while(scanf("%llu",&n)!=EOF){ +if(n==1) +printf("471\n"); +else + printf("%llu471\n",n-1); + + + } + +} + +/************************************************************** + Problem: 1047 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1048.c b/QuestionAns/peerin/1048.c new file mode 100644 index 0000000..ce5b5b6 --- /dev/null +++ b/QuestionAns/peerin/1048.c @@ -0,0 +1,58 @@ +#include + + +int main() +{ + int n,i,j,a,b,num,u,v; + int c[100][100]; + while(scanf("%d",&n)!=EOF) + { + num=n*n; + for(i=0; i +int array[1000000]={0}; +int max_term(int i,int j){ + int max = array[i]; + for(int index = i;index<=j;++index){ + if(array[index]>max){ + max = array[index]; + } + } + return max; +} + +int func(int input_beg, int input_end){ + static int caculated = 1; + if(input_end<=caculated){ + return max_term(input_beg,input_end); + }else{ + for(int i = caculated;i<=input_end;++i){ + int count = 0; + unsigned int n = i; + start:count++; + if(n == 1){ + goto end; + } + else{ + if(n%2!=0){ + n = n*3 + 1; + goto start; + } + else{ + n = n/2; + goto start; + } + + } + + end:array[i]=count; + + } + caculated = input_end; + return max_term(input_beg,input_end); + } + +} + +int max(int i,int j){ + return i>j?i:j; +} +int min(int i,int j){ + return i +#include +#include +#include +#include + +int main() +{ + int n, m; + int i, j; + int sta[2][1005]; + int f; + + while (1) { + if (scanf("%d", &n)==EOF) + break; + else { + memset(sta, 0, sizeof sta); + for (i=0; in?m:n); i++) { + if (f) { + printf("%d", sta[0][i]+sta[1][i]); + f=0; + } else { + printf(" %d", sta[0][i]+sta[1][i]); + } + } + putchar('\n'); + } + + + + + return 0; +} + +/************************************************************** + Problem: 1050 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1051.c b/QuestionAns/peerin/1051.c new file mode 100644 index 0000000..4ffb96b --- /dev/null +++ b/QuestionAns/peerin/1051.c @@ -0,0 +1,48 @@ +#include + +int main() +{ + int ar[1000] = { 0 }; + int n, i, a, j = 0, h, m=0,b=1,c; + scanf("%d",&n); + while (b<=n) { + b++; + c=0; + while(scanf("%d", &a)&&a!=0){ + ar[c] += a; + c++; + } + if (c > m) + m = c; + j++; + if (j == 2) { + for (i = 0; i < m; i++) + if (i == 0) + printf("%d", ar[i]); + else + printf(" %d", ar[i]); + printf("\n"); + j = 0; + m = 0; + for (h = 0; h < 1000; h++) + ar[h] = 0; + } + } + if (j == 1) { + for (i = 0; i < c; i++) + if (i == 0) + printf("%d", ar[i]); + else + printf(" %d", ar[i]); + printf("\n"); + } +} +/************************************************************** + Problem: 1051 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1052.c b/QuestionAns/peerin/1052.c new file mode 100644 index 0000000..b69cde3 --- /dev/null +++ b/QuestionAns/peerin/1052.c @@ -0,0 +1,97 @@ +#include +#include +int main() { + int q,i,t,m,n,x; + int a[1001]= {0}; + int b[1001]= {0}; + scanf("%d",&n); + for(q=1; q<=n; q++) { + if(q%2!=0) //奇数赋值给A + { + scanf("%d",&t); + for(i=0; im?t:m;//直接比较两个数组的长度 用if(t>m)讨论的话会多一倍的代码 比较麻烦 + if(x==0) //长度为0的情况 + { + printf("\n"); + } + else + { + for(i=0; im?t:m; + if(x==0) + { + printf("\n"); + } else { + for(i=0; i +#include +#define MAX_LINE 100 +#define MAX_COLUMN 100 +int mN[MAX_LINE][MAX_COLUMN]; + +int getMatrix(int m[][MAX_COLUMN], int l, int c) { + for (int i = 0; i < l; ++i) { + for (int j = 0; j < c; ++j) { + scanf("%d", &m[i][j]); + } + } + return 0; +} + +int revMatrix(int m[][MAX_COLUMN], int l, int c) { + + for (int i = 0; i < c; ++i) { + for (int j = 0; j < l; ++j) { + mN[i][j] = m[j][i]; + } + } + + return 0; +} + +int putMatrix(int l, int c) { + for (int i = 0; i < l; ++i) { + for (int j = 0; j < c; ++j) { + if (j == 0) + printf("%d", mN[i][j]); + else + printf(" %d", mN[i][j]); + } + printf("\n"); + } + return 0; +} + +int main(int argc, char* argv[]) { + + int n; + scanf("%d", &n); + for (int i = 0; i < n; ++i) { + int l, c; + scanf("%d%d", &l, &c); + int m[MAX_LINE][MAX_COLUMN]; + getMatrix(m, l, c); + revMatrix(m, l, c); + putMatrix( c, l); + if (i != n - 1) + printf("\n"); + } + + return 0; +} + +/************************************************************** + Problem: 1053 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:784 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1054.c b/QuestionAns/peerin/1054.c new file mode 100644 index 0000000..b6cd864 --- /dev/null +++ b/QuestionAns/peerin/1054.c @@ -0,0 +1,49 @@ +#include +#include +#include +int main() +{ + int arr1[105][105],arr2[105][105]; + int x,y; + while(scanf("%d%d",&x,&y)!=EOF&&x!=0&&y!=0) + { + int i,j,m, n; + for(i=0; i +#include +#include +void input(int input[102][102],int m,int n) +{ + int i,j; + for(i=0;i +#include +int chuli(char input[]){ + int index = 0,flag = 0; + int len = strlen(input); + //printf("%d\n",len); + for(int i = 0;is2_len){ + return 1; + } + else if(s1_len == s2_len){ + if(s1[0]>s2[0]){ + return 1; + + } + else if(s1[0]==s2[0]){ + if(s1[0]=='\0'&&s2[0]=='\0'){ + return 0; + }else{ + return biggerp(s1+1,s2+1); + } + } + else{ + return 0; + } + + } + else{ + return 0; + } +} + +int equalp(char s1[],char s2[]){ + return strcmp(s1,s2)==0?1:0; +} + +int lessp(char s1[],char s2[]){ + + return !(biggerp(s1,s2)||equalp(s1,s2))?1:0; + + +} +char max[1001] = {0}; +char min[1001] = {0}; + +int main(){ + char input[1001]={0}; + int flag = 0; + while(scanf("%s",input)!=EOF){ + chuli(input); + if(flag == 0){ + strcpy(max,input); + strcpy(min,input); + flag = 1; + } + + //printf("chuli done\n"); + if(biggerp(input,max)){ + memcpy(max,input,1001); + } + //printf("biggerp done\n"); + if(lessp(input,min)){ + + memcpy(min,input,1001); + } + memset(input,'\0',1001); + //printf("lessp done\n"); + } + printf("The maximum value is : %s\nThe minimum value is : %s",max,min); + return 0; +} + +/************************************************************** + Problem: 1060 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1061.c b/QuestionAns/peerin/1061.c new file mode 100644 index 0000000..ce39d94 --- /dev/null +++ b/QuestionAns/peerin/1061.c @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#define MAX_STR_LEN 101 + +int main() +{ + char a[1009]; + char b[1009]; + char c[1009]; + while(gets(a)!=NULL) + { + int l=strlen(a); + int i,j,k,m=0; + for(i=0;i='A' && a[i]<='Z') + { + b[m]=a[i]; + ++m; + } + if(a[i]>='a' && a[i]<='z') + { + b[m]=a[i]-'a'+'A'; + ++m; + } + if(a[i]>='0' && a[i]<='9') + { + b[m]=a[i]; + ++m; + } + } + b[m]=0; + // printf("%s\n",b); + l=strlen(b); + int x=0; + for(i=l-1;i>=0;--i) + { + char temp=b[i]; + c[x]=temp; + ++x; + } + + c[x]=0; + //printf("%s",c); + if(strcmp(b,c)==0) printf("Yes.\n"); + else printf("No.\n"); + } + return 0; +} + + +/************************************************************** + Problem: 1061 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1062.c b/QuestionAns/peerin/1062.c new file mode 100644 index 0000000..3e63249 --- /dev/null +++ b/QuestionAns/peerin/1062.c @@ -0,0 +1,72 @@ +#include +#include +#include +#include +#define MAX_STR_LEN 101 + +int main() +{ + int n,x,y; + scanf("%d",&n); + int i=0; +//freopen("123.txt","w",stdout); + char a[10009]; + char b[10009]; + for(i=0;i='a' && a[k]<='z') a[k]=a[k]-'a'+'A'; + } + for(k=0; k='A' && a[k]<='Z') + { + if(y>0) + { + a[k]=a[k]+y; + if(a[k]>'Z') a[k]=a[k]-26; + b[m]=a[k]; + ++m; + } + else + { + a[k]=a[k]+y; + if(a[k]<'A') a[k]=a[k]+26; + b[m]=a[k]; + ++m; + } + } + } + b[m]=0; + int ll=strlen(b); + + printf("%d %s\n",ll,b); + + } + //if(i +#include +#include +#include +#include +#define SWAP(a,b,t) t=a; a=b; b=t; +#define MAX 12 +char t[12][10] = {"14041","03030","13121","13131","04130","12131","12141","13030","14141","14131"}; +void Print(char ch,int n) +{ + while(n--) putchar(ch); +} +void PrintRow(char s[],int i,int n) +{ + int k; + for(k=0; s[k]; ++k) + { + if(k) putchar(' '); + switch(t[s[k]-'0'][i]) + { + case '0': + Print(' ',n+2); + break; + case '1': + putchar(' '); + Print('-',n); + putchar(' '); + break; + case '2': + putchar('|'); + Print(' ',n+1); + break; + case '3': + Print(' ',n+1); + putchar('|'); + break; + case '4': + putchar('|'); + Print(' ',n); + putchar('|'); + break; + } + } + putchar('\n'); +} +void Solve(char s[],int n) +{ + int i,j,k; + PrintRow(s,0,n); + for(j=0; j +#include +#include +#include +int main() +{ + int m,n; + //freopen("123.txt","r",stdin); + scanf("%d%d",&m,&n); + getchar(); + char name[109][30]; + int a[109][27]={0}; + int b[109]; + int i,j; + for( i=0;imax) max=l; + } + for( i=0; i=b[i]) + { + if(flag==0) printf("%s",name[k]); + else printf(",%s",name[k]); + flag=1; + flag2=1; + break; + } + } + } + + if(flag2==0) printf("NONE!"); + printf("\n"); + } +} +/************************************************************** + Problem: 1078 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1079.c b/QuestionAns/peerin/1079.c new file mode 100644 index 0000000..473c4ac --- /dev/null +++ b/QuestionAns/peerin/1079.c @@ -0,0 +1,23 @@ +#include +int main(){ + int n,a,b,c; + scanf("%d",&n); + for(int i = 0;i< n;++i){ + scanf("%d %d %d",&a,&b,&c); + printf("%s",a+b>c&&a+c>b&&b+c>a?"YES\n":"NO\n"); + + } + + + return 0; +} + +/************************************************************** + Problem: 1079 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1088.c b/QuestionAns/peerin/1088.c new file mode 100644 index 0000000..0d837a5 --- /dev/null +++ b/QuestionAns/peerin/1088.c @@ -0,0 +1,25 @@ +#include +#include +#include +int main(){ +int n; +scanf("%d",&n); +n = abs(n); +if(n<100){ + printf("%d",n); +} +else{ + printf("%02d",n%100); +} +return 0; +} + +/************************************************************** + Problem: 1088 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1092.c b/QuestionAns/peerin/1092.c new file mode 100644 index 0000000..de2506c --- /dev/null +++ b/QuestionAns/peerin/1092.c @@ -0,0 +1,26 @@ +#include +#include + +int main(){ + +char s[101]; +scanf("%s",s); +int len = strlen(s); +int i; +for(i = len-1;i>=0;--i) + printf("%c",s[i]); + + + +return 0; +} + +/************************************************************** + Problem: 1092 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1093.c b/QuestionAns/peerin/1093.c new file mode 100644 index 0000000..b2bd283 --- /dev/null +++ b/QuestionAns/peerin/1093.c @@ -0,0 +1,39 @@ +#include +#include + +int main(){ + + char passwd[20] = {0}; + scanf("%s",passwd); + char input[20] = {0}; + int count = 0; + while(scanf("%s",input)!=EOF){ + count++; + if(strcmp(input,passwd)==0&&count<=5){ + printf("Welcome!\n"); + } + else if(count>5){ + printf("Out of limited!\n"); + } + else{ + + printf("Wrong!\n"); + } + + + } + + + + return 0; +} + +/************************************************************** + Problem: 1093 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1094.c b/QuestionAns/peerin/1094.c new file mode 100644 index 0000000..84cd259 --- /dev/null +++ b/QuestionAns/peerin/1094.c @@ -0,0 +1,61 @@ +#include +#include +#include + +int getchar_no_space(char input[]){ + char result[101]={0}; + int index = 0; + int input_len = strlen(input); + for(int i = 0;i=0;--i){ + if(!isspace(input[i])){ + end = i; + break; + } + } + input[end+1]='\0'; + char input2[101]={0}; + memcpy(input2,input,101); + getchar_no_space(input2); + if(strcmp(input2,"END")==0){ + printf("%s",input2); + break; + }else{ + printf("%s\n",input+beg); + } + gets(input); + } + return 0; +} + +/************************************************************** + Problem: 1094 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1095.c b/QuestionAns/peerin/1095.c new file mode 100644 index 0000000..a6a1019 --- /dev/null +++ b/QuestionAns/peerin/1095.c @@ -0,0 +1,34 @@ +#include +int fib[50]; +// 2 * 1024 * 1024/4 +int fib_f(int n){ + + fib[0] = 1; + fib[1] = 2; + for(int i = 2;i +/* +若输入的三条边构成等边三角形,输出“a equileteral triangle”; + +若输入的三条边构成等腰三角形,输出“a isosceles triangle”; + +若输入的三条边构成直角三角形,输出“a right triangle”; + +若输入的三条边构成三角形,但不是以上三种,则输出“a triangle”; + +若输入的三条边不构成,输出“not a triangle”。 + */ +int main(){ + + int a,b,c; + while(scanf("%d%d%d",&a,&b,&c)!=EOF){ + if(a==0&&b==0&&c==0) + break; + printf("%s",a+b>c&&a+c>b&&b+c>a&&a-b + + +int main(){ + + int num; + while(scanf("%d",&num)!=EOF&&num!=0){ + + printf("%d%s\n",num,num%10==1?"st":num%10==2?"nd":num%10==3?"rd":"th"); + + + } + + +} + +/************************************************************** + Problem: 1098 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1099.c b/QuestionAns/peerin/1099.c new file mode 100644 index 0000000..c4e28e0 --- /dev/null +++ b/QuestionAns/peerin/1099.c @@ -0,0 +1,45 @@ + #include +#include +int cmpfunc (const void * a, const void * b) +{ + return ( *(int*)a - *(int*)b ); +} + +int main(){ + + int n; + scanf("%d",&n); + if(n<=0)return 1; + int list[n]; + for(int i=0;i*(list+j+1)){ */ +/* int temp = *(list+j); */ +/* *(list+j)=*(list+j+1); */ +/* *(list+j+1)=temp; */ +/* } */ +/* } */ +/* } */ + qsort(list,n,4,cmpfunc); + for(int i = 0;i + + +int main(){ + int n; + scanf("%d",&n); + printf("Sun Mon Tue Wen Thu Fri Sat\n"); + if(n!=7){ + + for(int i = 0;i<(n*4);++i){ + printf(" "); + + + } + } + int n1 = 7-n; + for(int i = 1;i<=30;++i){ + if(i==n1||(i-n1)%7==0){ + printf("%3d\n",i); + + } + else if(i == 30){ + + printf("%3d",i); + } + else{ + + printf("%3d ",i); +} +} + + return 0; +} + +/************************************************************** + Problem: 1100 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1101.c b/QuestionAns/peerin/1101.c new file mode 100644 index 0000000..2f7d110 --- /dev/null +++ b/QuestionAns/peerin/1101.c @@ -0,0 +1,31 @@ +#include +int main(){ + + int n; + scanf("%d",&n); + for(int i = 0;i12||month<1||day<1||day>31){printf("error date!\n");continue;} + if((!is_leap)&&month==2&&(day>28)||is_leap&&month==2&&(day>29)||(!(month==1||month==3||month==5||month==7||month==8||month==10||month==12))&&(day>30)){printf("error date!\n");continue;} + + int sum_day = 0; + for(int i = 1;i +#define SWAP(t,x,y) t=x;x=y;y=t + +int int_swap(int *x1,int *y1){ + int tmp = *x1; + *x1 = *y1; + *y1 = tmp; + return 0; +} + +int dbl_swap(double *x1,double *y1){ + double tmp = *x1; + *x1 = *y1; + *y1 = tmp; + return 0; +} + + + + + + +int main() +{ + int x1, y1, t1; + double x2, y2, t2; + + scanf("%d %d", &x1, &y1); + int_swap(&x1, &y1); + printf("%d %d\n", x1, y1); + + scanf("%d %d", &x1, &y1); + SWAP(t1, x1, y1); + printf("%d %d\n", x1, y1); + + scanf("%lf %lf", &x2, &y2); + dbl_swap(&x2, &y2); + printf("%lg %lg\n", x2, y2); + + scanf("%lf %lf", &x2, &y2); + SWAP(t2, x2, y2); + printf("%lg %lg\n", x2, y2); +} + +/************************************************************** + Problem: 1107 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1133.c b/QuestionAns/peerin/1133.c new file mode 100644 index 0000000..bff01a0 --- /dev/null +++ b/QuestionAns/peerin/1133.c @@ -0,0 +1,50 @@ +#include +#include +#include +#define MAX_STR_LEN 11 + +int strToInt(char s[]){ + if(strlen(s) == 0) return -1; + if(!(s[0] >= '0' && s[0] <= '9')) return 0; + int beg = 0; + int i; + for(i = 0;s[i] != '\0';++i){ + if(s[i] >= '0' && s[i] <= '9'){ + beg = i; + break; + } + } + int res = 0; + int count = 0; + for(i = beg;s[i] >= '0' && s[i] <= '9' && s[i] != '\0';++i){ + if(s[i] == '0' && i == beg){ + beg++; + continue; + } + count++; + } + // printf("count:%d\nbeg:%d\n",count,beg); + for(i = beg;(i - beg) < count;++i){ + res += pow(10,count - (i - beg) - 1) * (s[i] - '0'); + } + return res; +} + + +int main() +{ + char s[MAX_STR_LEN]; + while(gets(s) != NULL) + printf("%d\n", strToInt(s)); + return 0; +} + +/************************************************************** + Problem: 1133 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:760 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1134.c b/QuestionAns/peerin/1134.c new file mode 100644 index 0000000..3cac568 --- /dev/null +++ b/QuestionAns/peerin/1134.c @@ -0,0 +1,63 @@ +#include +#include +#include +#define MAX_STR_LEN 12 + +int strToInt(char s[]){ + int negFlag = 0; + int len = strlen(s); + if(len == 0) return 0; + int i; + for(i = 0;i < len;++i){ + if(i == 0){ + if(!(s[i] >= '0' && s[i] <= '9')){ + if(s[i] == '+') negFlag = 0; + else if(s[i] == '-') negFlag = 1; + else return 0; + } + } + else{ + if(!(s[i] >= '0' && s[i] <= '9')) return 0; + else break; + } + } + int beg = 0; + for(i = 0;s[i] != '\0';++i){ + if(s[i] >= '0' && s[i] <= '9'){ + beg = i; + break; + } + } + int res = 0; + int count = 0; + for(i = beg;s[i] >= '0' && s[i] <= '9' && s[i] != '\0';++i){ + if(s[i] == '0' && i == beg){ + beg++; + continue; + } + count++; + } + // printf("count:%d\nbeg:%d\n",count,beg); + for(i = beg;(i - beg) < count;++i){ + res += pow(10,count - (i - beg) - 1) * (s[i] - '0'); + } + return negFlag == 1?-res:res; +} + + +int main() +{ + char s[MAX_STR_LEN]; + while(gets(s) != NULL) + printf("%d\n", strToInt(s)); + return 0; +} +/************************************************************** + Problem: 1134 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:760 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1135.c b/QuestionAns/peerin/1135.c new file mode 100644 index 0000000..db60153 --- /dev/null +++ b/QuestionAns/peerin/1135.c @@ -0,0 +1,83 @@ +#include +#include +#include +#define MAX_STR_LEN 11 + +int extractStr(char t[],char s[],int len){ + int i; + int idx = 0; + for(i = 0;i < len;++i){ + if(s[i] >= '0' && s[i] <= '9'){ + t[idx++] = s[i]; + } + else if(i == 0){ + if(s[i] == '-') + t[idx++] = '-'; + } + } + t[idx] = '\0'; + return 0; +} + +int strToInt(char s[]){ + int negFlag = 0; + int len = strlen(s); + char strExtracted[MAX_STR_LEN] = {0}; + extractStr(strExtracted,s,len); + len = strlen(strExtracted); + memcpy(s,strExtracted,MAX_STR_LEN); + if(len == 0) return 0; + int i; + for(i = 0;i < len;++i){ + if(i == 0){ + if(!(s[i] >= '0' && s[i] <= '9')){ + if(s[i] == '+') negFlag = 0; + else if(s[i] == '-') negFlag = 1; + else return 0; + } + } + else{ + if(!(s[i] >= '0' && s[i] <= '9')) return 0; + else break; + } + } + int beg = 0; + for(i = 0;s[i] != '\0';++i){ + if(s[i] >= '0' && s[i] <= '9'){ + beg = i; + break; + } + } + int res = 0; + int count = 0; + for(i = beg;s[i] >= '0' && s[i] <= '9' && s[i] != '\0';++i){ + if(s[i] == '0' && i == beg){ + beg++; + continue; + } + count++; + } + // printf("count:%d\nbeg:%d\n",count,beg); + for(i = beg;(i - beg) < count;++i){ + res += pow(10,count - (i - beg) - 1) * (s[i] - '0'); + } + return negFlag == 1?-res:res; +} + + +int main() +{ + char s[MAX_STR_LEN]; + while(gets(s) != NULL) + printf("%d\n", strToInt(s)); + return 0; +} +/************************************************************** + Problem: 1135 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:760 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1136.c b/QuestionAns/peerin/1136.c new file mode 100644 index 0000000..a4676e5 --- /dev/null +++ b/QuestionAns/peerin/1136.c @@ -0,0 +1,177 @@ +#include +#include +#include +#include +#define MAX_STR_LEN 101 +#define POSITIVE 1 +#define NEGATIVE 0 + +int strToUpper(char s[]){ + + int i; + for(i = 0;s[i] != '\0';++i){ + s[i] = toupper(s[i]); + } + return i; +} + +int ishex(int c){ + + if((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')) + return 1; + else + return 0; + +} + +int isbin(int c){ + + if(c >= '0' && c <= '1') + return 1; + else + return 0; + +} + +int isoct(int c){ + + if(c >= '0' && c <= '7') + return 1; + else + return 0; + +} + +int isdec(int c){ + if(c >= '0' && c <= '9') + return 1; + else + return 0; +} + +int (*(retOp(int base)))(int){ + switch(base){ + case 2: + return isbin; + break; + case 8: + return isoct; + break; + case 10: + return isdec; + break; + case 16: + return ishex; + break; + default: + return NULL; + } +} + +void conv(char s[],int len){ + + int i; + for(i = 0;i < len;++i){ + switch(s[i]){ + case '1': + s[i] = 1; + break; + case '2': + s[i] = 2; + break; + case '3': + s[i] = 3; + break; + case '4': + s[i] = 4; + break; + case '5': + s[i] = 5; + break; + case '6': + s[i] = 6; + break; + case '7': + s[i] = 7; + break; + case '8': + s[i] = 8; + break; + case '9': + s[i] = 9; + break; + case '0': + s[i] = 0; + break; + case 'A': + s[i] = 10; + break; + case 'B': + s[i] = 11; + break; + case 'C': + s[i] = 12; + break; + case 'D': + s[i] = 13; + break; + case 'E': + s[i] = 14; + break; + case 'F': + s[i] = 15; + break; + default: + ; + } + } +} + +int strToIntCustome(char s[],int (*op)(int),int base){ + int i,count = 0,res = 0; + char ch; + char s2[MAX_STR_LEN] = {0}; + for(i = 0;(ch = s[i]) != '\0';++i){ + if(op(ch)){ + s2[count++] = ch; + } + } + conv(s2,count); + for(i = 0;i < count;++i){ + res += pow(base,count - i - 1) * s2[i]; + } + return res; +} + +int strToInt(char s[],int base){ + int len = strToUpper(s),symFlag = POSITIVE; + int i; + char s2[MAX_STR_LEN] = {0}; + if(s[0] == '-') symFlag = NEGATIVE; + if(s[0] == '+') symFlag = POSITIVE; + if(s[0] == '-' || s[0] == '+') memcpy(s2,s + 1,MAX_STR_LEN - 1); + else memcpy(s2,s,MAX_STR_LEN); + int (*op)(int) = retOp(base); + int res = strToIntCustome(s2,op,base); + return symFlag == POSITIVE ? res : -res; +} + + +int main() +{ + int base; + char s[MAX_STR_LEN]; + while( (scanf("%d:", &base) != EOF) && (gets(s) != NULL) ) + printf("%d\n", strToInt(s, base)); + return 0; +} + +/************************************************************** + Problem: 1136 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:760 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1138.c b/QuestionAns/peerin/1138.c new file mode 100644 index 0000000..824345b --- /dev/null +++ b/QuestionAns/peerin/1138.c @@ -0,0 +1,28 @@ +#include +#define MAX_STR_LEN 100 + +int str_cmp(char s1[],char s2[]){ + for(int i = 0;s1[i]!='\0';++i){ + int d = s1[i]-s2[i]; + if(d!=0)return d; +} + return 0; +} + + +int main() +{ + char str1[MAX_STR_LEN], str2[MAX_STR_LEN]; + while( (gets(str1) != NULL) && (gets(str2) != NULL) ) + printf("%d\n", str_cmp(str1, str2)); + return 0; +} +/************************************************************** + Problem: 1138 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1139.c b/QuestionAns/peerin/1139.c new file mode 100644 index 0000000..709c184 --- /dev/null +++ b/QuestionAns/peerin/1139.c @@ -0,0 +1,35 @@ +#include +#define MAX_STR_LEN 101 + +char ch_abs(char num){ + return num>0?num:-num; +} + +int str_cmp(char s1[],char s2[]){ + int idx = 0; + while(1){ + char d = s1[idx]-s2[idx]; + if(!(ch_abs(d)=='a'-'A'||d==0))return d; + if(s1[idx]=='\0'&&s2[idx]=='\0') return 0; + idx++; + } +} + + + +int main() +{ + char str1[MAX_STR_LEN], str2[MAX_STR_LEN]; + while( (gets(str1) != NULL) && (gets(str2) != NULL) ) + printf("%d\n", str_cmp(str1, str2)); + return 0; +} +/************************************************************** + Problem: 1139 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1140.c b/QuestionAns/peerin/1140.c new file mode 100644 index 0000000..4ce68cc --- /dev/null +++ b/QuestionAns/peerin/1140.c @@ -0,0 +1,78 @@ +#include +#define MAX_SIZE 1000 +#define OVER -1 +#define EXIST -2 + +int globalLen; + +int getarray(int a[]){ + int currentNum; + int i=0; + while(1){ + scanf("%d",¤tNum); + if(currentNum==0) break; + a[i++]=currentNum; + } + globalLen = i; + return i; +} + +int insert(int a[],int key, int vol){ + if(globalLen > vol){ + return OVER; + } + int i,eqFlag = 0; + for(i = 0;i < globalLen;++i){ + if(a[i] == key){ + eqFlag = 1; + } + } + if(eqFlag == 1){ + return EXIST; + } + int res = 0; + for(i = 0;i < globalLen;++i){ + if(key > a[i]){ + res = i + 1; + } + } + return res; +} + +int result(int sig){ + switch(sig){ + case OVER: + printf("The array if full!\n"); + break; + case EXIST: + printf("The key is already in this array!\n"); + break; + default: + printf("The key is inserted in position %d.\n",sig); + break; + } + return 0; +} + + +int main() +{ + int array[MAX_SIZE], cases, i, key; + scanf("%d", &cases); + for(i = 1; i <= cases; i++) + { + getarray(array); + scanf("%d", &key); + result(insert(array, key, MAX_SIZE - 1)); + } + return 0; +} +/************************************************************** + Problem: 1140 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1141.c b/QuestionAns/peerin/1141.c new file mode 100644 index 0000000..c6ec0f6 --- /dev/null +++ b/QuestionAns/peerin/1141.c @@ -0,0 +1,105 @@ +#include +#include +#define MAX_SIZE 1000 +#define OVER -1 +#define EXIST -2 + +int globalLen; + +int getarray(int a[]){ + int currentNum; + int i=0; + while(1){ + scanf("%d",¤tNum); + if(currentNum==0) break; + a[i++]=currentNum; + } + globalLen = i; + return i; +} + +int insert(int a[],int key, int vol){ + if(globalLen > vol){ + return OVER; + } + int i,eqFlag = 0; + for(i = 0;i < globalLen;++i){ + if(a[i] == key){ + eqFlag = 1; + } + } + if(eqFlag == 1){ + return EXIST; + } + int res = 0; + for(i = 0;i < globalLen;++i){ + if(key > a[i]){ + res = i + 1; + } + } + int tmp[MAX_SIZE]={0}; + int idx = 0; + for(i = 0;i < globalLen + 1;++i){ + if(i == res){ + tmp[i] = key; + } + else{ + tmp[i] = a[idx++]; + } +} + memcpy(a,tmp,MAX_SIZE); + globalLen++; + return res; +} + +int result(int sig){ + switch(sig){ + case OVER: + printf("The array if full!\n"); + break; + case EXIST: + printf("The key is already in this array!\n"); + break; + default: + printf("The key is inserted in position %d.\n",sig); + break; + } + return 0; +} + +int getkey(int k[]){ + + int size; + scanf("%d",&size); + int i; + for(i = 0;i < size;++i){ + scanf("%d",k + i); + } + return size; +} + + +int main() +{ + int array[MAX_SIZE], cases, ca, i, key[MAX_SIZE], size; + scanf("%d", &cases); + for(ca = 1; ca <= cases; ca++) + { + getarray(array); + size = getkey(key); + printf("Case %d:\n", ca); + for(i = 0; i < size; i++) + result(insert(array, key[i], MAX_SIZE - 1)); + } + return 0; +} + +/************************************************************** + Problem: 1141 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1144.c b/QuestionAns/peerin/1144.c new file mode 100644 index 0000000..223cdf6 --- /dev/null +++ b/QuestionAns/peerin/1144.c @@ -0,0 +1,63 @@ +#include +#define MAX_SIZE 1000 + +int get_array(int a[]){ + int n; + scanf("%d",&n); + for(int i = 0;imax)max = a[i]; + } + return max; +} + +int max_index(int idx[],int a[],int n){ + int max = max_value(a,n); + int count=0; + for(int i =0;i + +int main(){ + int N; + scanf("%d",&N); + int i; + for(i = 1;i<=N;++i){ + + int max,min; + scanf("%d%d",&min,&max); + int sum = 0; + int j; + for(j = min;j<=max;++j){ + sum += j; + } + printf("case %d:sum=%d.\n",i,sum); + + } + return 0; +} + +/************************************************************** + Problem: 1145 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1146.c b/QuestionAns/peerin/1146.c new file mode 100644 index 0000000..24923f9 --- /dev/null +++ b/QuestionAns/peerin/1146.c @@ -0,0 +1,58 @@ +#include +#include +double func(double x){ + + if(x<0){ + + return -x; + + } + else if(x>=0&&x<1){ + return sin(2 * x); + + } + else if(x>=1&&x<5){ + + + return sqrt(x*x*x+x); + + } + else{ + return 2*x+10; + } + + + +} + + + +int output(int n,double x){ + + printf("case %d:y=%.6g.\n",n,x); + return 1; + +} + + +int main() +{ + int i, cases; + double x; + scanf("%d", &cases); + for(i = 1; i <= cases; i++) + { + scanf("%lf", &x); + output(i, func(x)); + } + return 0; +} +/************************************************************** + Problem: 1146 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:756 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1149.c b/QuestionAns/peerin/1149.c new file mode 100644 index 0000000..73fa5e9 --- /dev/null +++ b/QuestionAns/peerin/1149.c @@ -0,0 +1,30 @@ +#include +#include + + +int main(){ + + int n; + scanf("%d",&n); + int i; + getchar(); + for(i = 0;i +#define MAX_SIZE 1000 + +int get_array(int a[]){ + + int size; + scanf("%d",&size); + for(int i = 0;i +#define MAX_SIZE 1000 + +int get_array(int a[],int n){ + int i; +for(i = 0;i +int main(){ +int a,b; +scanf("%d%d",&a,&b); +printf("Octal Decimal Hexadecimal\n"); +printf("%-6o%-8d%x\n%-6o%-8d%x",a,a,a,b,b,b); +return 0; +} + +/************************************************************** + Problem: 1158 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1162.c b/QuestionAns/peerin/1162.c new file mode 100644 index 0000000..9bd474a --- /dev/null +++ b/QuestionAns/peerin/1162.c @@ -0,0 +1,42 @@ +#include + +int main(){ + double x,y; + scanf("(%lf, %lf)",&x,&y); + if(x==0){ + if(y==0){ + printf("(0.0, 0.0) is origin"); + }else + printf("(%.1f, %.1f) is on the y axis",x,y); +} + else if(y == 0){ + printf("(%.1f, %.1f) is on the x axis",x,y); + } + else if(x<0){ + if(y>0){ + printf("(%.1f, %.1f) is in quadrand II",x,y); +} + else if(y<0){ + printf("(%.1f, %.1f) is in quadrand III",x,y); + } + } + else if(x>0){ + if(y>0){ + printf("(%.1f, %.1f) is in quadrand I",x,y); +} + else if(y<0){ + printf("(%.1f, %.1f) is in quadrand IV",x,y); + } + } + return 0; +} + +/************************************************************** + Problem: 1162 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1163.c b/QuestionAns/peerin/1163.c new file mode 100644 index 0000000..c19b46b --- /dev/null +++ b/QuestionAns/peerin/1163.c @@ -0,0 +1,46 @@ +#include + +int trans(int hour24){ + + + + if(hour24==0)return 12; + if(hour24>0&&hour24<=12)return hour24; + if(hour24>12&&hour24<24)return hour24-12; + + + +} + +int ap(int hour24){ + + if(hour24==0)return 1; + if(hour24>0&&hour24<12)return 1; + if(hour24>=12&&hour24<24)return 0; + + + +} + + +int main(){ + + int hour24,minute24; + scanf("%d:%d",&hour24,&minute24); + int hour12,minute12; + minute12 = minute24; + hour12 = trans(hour24); + printf("%02d:%02d %s\n",hour12,minute12,ap(hour24)?"a.m.":"p.m."); + + return 0; +} + +/************************************************************** + Problem: 1163 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1167.c b/QuestionAns/peerin/1167.c new file mode 100644 index 0000000..d6ea5b0 --- /dev/null +++ b/QuestionAns/peerin/1167.c @@ -0,0 +1,43 @@ +#include + +int main(){ + + int n; + scanf("%d",&n); + if(n==0){ + printf("0"); + + } + else if(n>0){ + int i; + for( i = 1;i<= n;++i){ + printf("%d",i); + if(i!=n) printf(" "); + + + + } + + } + else if(n<0){ + + int i; + for( i = n;i<=-1;++i){ + + printf("%d",i); + if(i!=-1) printf(" "); + + } + + } +} + +/************************************************************** + Problem: 1167 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1168.c b/QuestionAns/peerin/1168.c new file mode 100644 index 0000000..2cc5420 --- /dev/null +++ b/QuestionAns/peerin/1168.c @@ -0,0 +1,43 @@ +#include + +int main(){ + + long long n; + scanf("%lld",&n); + long long i; + for(i = 0;i < n;++i){ + long long p,q; + scanf("%lld%lld",&p,&q); + + long long j; + long long temp = p; +if(p>=q){ + p = q; + q = temp; + } +for(j = p;j<=q;++j){ + printf("%lld",j); + if(j!=q)printf(" "); + } + + + + if(i!=n-1)printf("\n\n"); + else ; + + + + } + + +} + +/************************************************************** + Problem: 1168 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1169.c b/QuestionAns/peerin/1169.c new file mode 100644 index 0000000..a3520af --- /dev/null +++ b/QuestionAns/peerin/1169.c @@ -0,0 +1,55 @@ +#include +#include +#include +#define IN_WORD 0 +#define OUT_OF_WORD 1 + +int analyse(char s[]){ + int len = strlen(s); + int result = 0; + int status = OUT_OF_WORD; + for(int i = 0;i +#include + +int rev(char s[]){ + int len = 100; + char s1[100]={0}; + int numcount = 0; + for(int i = 0;i < len;++i){ + if(s[i]!=0)numcount++; + } + + for(int i = 0;i + +int main(){ + + int m; + scanf("%d",&m); + for(int i = 0;i + +int main(){ + + int array[101]={0}; + int score; + while(scanf("%d",&score)!=EOF){ + if(score>=0&&score<=100) + array[score]++; + + } + int max = 0; + for(int i = 0;i<=100;++i){ + + if(array[i]>max){ + + max = array[i]; + + } + + } + + for(int i = 0;i<=100;++i){ + + if(array[i]==max){ + printf("%d\n",i); + } + + } + + return 0; +} + +/************************************************************** + Problem: 1178 + User: 202211070518 + Language: C + Result: Accepted + Time:16 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1179.c b/QuestionAns/peerin/1179.c new file mode 100644 index 0000000..c15120c --- /dev/null +++ b/QuestionAns/peerin/1179.c @@ -0,0 +1,76 @@ +#include +#include +#include +/* void filter(int* list,int start){ */ +/* int newlist[50000]={0}; */ +/* if(list[start]==0) ; */ +/* else{ */ +/* for(int i = 0;i<=start;++i){ */ +/* newlist[i]=list[i]; */ +/* } */ +/* int count = start+1; */ +/* for(int i = start;list[i]!=0;++i){ */ +/* if(list[i]%list[start]!=0){ */ +/* newlist[count++]=list[i]; */ +/* } */ +/* } */ +/* for(int i = 0;i<50000;++i){ */ +/* list[i] = newlist[i]; */ +/* } */ +/* // printf("%d\n",start); */ +/* filter(list,++start); */ +/* } */ +/* } */ + +int main(){ + int start = 0; + int* list = calloc(500001,sizeof(int)); + for(int i = 2;i<=500001;++i){ + list[i-2]=i; + } + // filter(list,0); + while(start<=708){ //啊哈哈啊哈哈哈哈哈哈,终于被我发现了 只要到根号下500000就好了 不用循环500000次 妈的! + int* newlist = calloc(500001,sizeof(int)); + //printf("%d\n",start); + for(int i = 0;i<=start;++i){ + newlist[i]=list[i]; + } + int count = start+1; + for(int i = start;list[i]!=0;++i){ + if(list[i]%list[start]!=0){ + newlist[count++]=list[i]; + } + } + int* temp = list; + list = newlist; + start++; + free(temp); + } + + int m,n ; + while(scanf("%d%d",&m,&n)!=EOF){ + for(int i = 0;list[i]!=0;++i){ + //printf("%d,",list[i]); + } + int flag = 0; + for(int i = 0;list[i]!=0;++i){ + if(list[i]>=m&&list[i]<=n){ + flag = 1; + printf("%d\n",list[i]); + } + } + if(flag==1)printf("\n"); + else if(flag==0)printf("\n\n"); + } + return 0; +} + +/************************************************************** + Problem: 1179 + User: 202211070518 + Language: C + Result: Accepted + Time:1072 ms + Memory:4652 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1180.c b/QuestionAns/peerin/1180.c new file mode 100644 index 0000000..1f0aff9 --- /dev/null +++ b/QuestionAns/peerin/1180.c @@ -0,0 +1,64 @@ +#include +#include +#define MAX_SIZE 10000 +struct date{ + int year; + int month; + int day; +}; + +int get_date_array(struct date d[]){ + int n = 0; + while(scanf("%d/%d/%d",&d[n].month,&d[n].day,&d[n].year) != EOF){ + n++; + } + return n; +} + +int cmpdate(const void *a1,const void *a2){ + struct date *d1 = (struct date *)a1; + struct date *d2 = (struct date *)a2; + if(d1->year < d2->year) + return -1; + else if(d1->year > d2->year) + return 1; + else + if(d1->month < d2->month) + return -1; + else if(d1->month > d2->month) + return 1; + else + if(d1->day < d2->day) + return -1; + else if(d1->day > d2->day) + return 1; + else + return 0; +} + +void sort_date_array(struct date d[],int n){ + qsort(d,n,sizeof(int) * 3,cmpdate); +} + + +int main() +{ + struct date d_arr[MAX_SIZE]; + int cases = 0, i, j; + + cases = get_date_array(d_arr); + sort_date_array(d_arr, cases); + + for(i = 0; i < cases; i++) + printf("%02d/%02d/%d\n", d_arr[i].month, d_arr[i].day, d_arr[i].year); + return 0; +} +/************************************************************** + Problem: 1180 + User: 202211070518 + Language: C + Result: Accepted + Time:32 ms + Memory:800 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1184.c b/QuestionAns/peerin/1184.c new file mode 100644 index 0000000..1036bdf --- /dev/null +++ b/QuestionAns/peerin/1184.c @@ -0,0 +1,43 @@ +#include +#include + +int main() +{ + int n, a = 0; + while (scanf("%d", &n) != EOF) { + int ar[n][n]; + memset(ar, 0, sizeof ar); + int k = 1, i = 0, j = n - 1; + ar[i][j] = k++; + while (k <= n * n) { + while (i + 1 < n && !ar[i + 1][j]) + ar[++i][j] = k++; + while (j - 1 >= 0 && !ar[i][j - 1]) + ar[i][--j] = k++; + while (i - 1 >= 0 & !ar[i - 1][j]) + ar[--i][j] = k++; + while (j + 1 < n && !ar[i][j + 1]) + ar[i][++j] = k++; + } + if (a++) + printf("\n"); + for (i = 0; i < n; i++) { + for (j = 0; j < n; j++) + if (j) + printf(" %d", ar[i][j]); + else + printf("%d", ar[i][j]); + printf("\n"); + } + } +} + +/************************************************************** + Problem: 1184 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1187.c b/QuestionAns/peerin/1187.c new file mode 100644 index 0000000..3f1bafb --- /dev/null +++ b/QuestionAns/peerin/1187.c @@ -0,0 +1,45 @@ +#include +#include + +int get_digit_sum_as_string(char *s,int sum){ + int s_len = strlen(s); + + + if(s[0]=='\0'){ + return sum; + + } + else{ + int num = s[0]-'0'; + sum += num; + get_digit_sum_as_string(s+1,sum); + + + } +} + + + + +int main(){ + int n; + scanf("%d",&n); + for(int i = 0;i +#define MAX_STR_LEN 1001 + +int str_len(char s[]){ + int count = 0; + while(s[count++]!='\0') ; + return count-1; + +} + + +int main() +{ + int n; + char s[MAX_STR_LEN]; + while(gets(s) != NULL) + printf("%d\n", str_len(s)); + return 0; +} + +/************************************************************** + Problem: 1189 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1200.c b/QuestionAns/peerin/1200.c new file mode 100644 index 0000000..45145d1 --- /dev/null +++ b/QuestionAns/peerin/1200.c @@ -0,0 +1,31 @@ +#include +#include +#include +#include +#define SWAP(a,b,t) t=a; a=b; b=t; + +int main() +{ + int n; + scanf("%d",&n); + int i; + double x; + for(i=0; i +#define MAX_SIZE 200 +#include +#include + +int main() +{ + int n; + scanf("%d",&n); + int i,k,j,l; + for(i=1;i<=n;++i) + { + double x; + scanf("%lf",&x); + double y=1.0/pow(cos(x),3); + printf("%.2lf\n",y); + } + + +} + + +/************************************************************** + Problem: 1206 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:760 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1207.c b/QuestionAns/peerin/1207.c new file mode 100644 index 0000000..b4ac6c8 --- /dev/null +++ b/QuestionAns/peerin/1207.c @@ -0,0 +1,35 @@ +#include +int cac(int M){ + int sum = 0; + for(int i = 100;i<=999;++i){ + if(i%M==0&&(i/100!=i%10&&i/100!=(i%100)/10&&i%10!=(i%100)/10)) + sum += i; + + } + return sum; +} + + +int main(){ + int M; + int i = 0; + while(scanf("%d",&M)!=EOF){ + i++; + printf("case %d:%d\n",i,cac(M)); + + } + + + + return 0; +} + +/************************************************************** + Problem: 1207 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1208.c b/QuestionAns/peerin/1208.c new file mode 100644 index 0000000..daa8a1b --- /dev/null +++ b/QuestionAns/peerin/1208.c @@ -0,0 +1,52 @@ +#include +#include +#include + +int swap_any(void *s,void *t,size_t n){ + + char *tmp = (char *)malloc(n); + memcpy(tmp,t,n); + memcpy(t,s,n); + memcpy(s,tmp,n); + return 0; +} + + + +int main() +{ + int a, b; + double x, y; + char c, d; + char s[1001], t[1001]; + + gets(s); + gets(t); + swap_any(s, t, sizeof(s)); + printf("%s %s\n", s, t); + + c = getchar(); + getchar(); + d = getchar(); + getchar(); + swap_any(&c, &d, sizeof(char)); + printf("%c %c\n", c, d); + + scanf("%d %d", &a, &b); + swap_any(&a, &b, sizeof(int)); + printf("%d %d\n", a, b); + + scanf("%lf %lf", &x, &y); + swap_any(&x, &y, sizeof(double)); + printf("%lg %lg\n", x, y); +} + +/************************************************************** + Problem: 1208 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1212.c b/QuestionAns/peerin/1212.c new file mode 100644 index 0000000..5b29f1f --- /dev/null +++ b/QuestionAns/peerin/1212.c @@ -0,0 +1,55 @@ +#include +int multiply_recursive(int a,int b){ + + if(a==0||b==0){ + return 0; + } + else if(a==1){ + return b; + } + else if(a==-1){ + return -b; + } + else if(b==1){ + return a; + } + else if(b==-1){ + return -a; + } + else if(a>0){ + if(b>0){ + return multiply_recursive(a,b-1)+a; + } + else if(b<0){ + return -multiply_recursive(a,-b); + } + } + else if(a<0){ + if(b>0){ + return multiply_recursive(a,b-1)+a; + } + else if(b<0){ + return multiply_recursive(-a,-b); + + } + + } + +} +int main(){ + + int a,b; + scanf("%d%d",&a,&b); + printf("%d",multiply_recursive(a,b)); + +} + +/************************************************************** + Problem: 1212 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1213.c b/QuestionAns/peerin/1213.c new file mode 100644 index 0000000..e210468 --- /dev/null +++ b/QuestionAns/peerin/1213.c @@ -0,0 +1,43 @@ +#include +#define MAX_STR_LEN 101 + + +int str_len(char *s){ + int len = 0; + while(s[len++] != '\0') ; + return len; +} + +char * str_cat(char *t,char *s){ + int i = 0; + int tL = str_len(t); + while(s[i] != '\0'){ + t[tL + i - 1] = s[i]; + i++; + } + t[tL + i - 1] = '\0'; + return t; +} + + +int main() +{ + char s[MAX_STR_LEN], str[MAX_STR_LEN], *p; + while(gets(s) != NULL && gets(str) != NULL) + { + p = str_cat(str, s); + puts(p); + puts(str); + } + return 0; +} + +/************************************************************** + Problem: 1213 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1214.c b/QuestionAns/peerin/1214.c new file mode 100644 index 0000000..c2ea550 --- /dev/null +++ b/QuestionAns/peerin/1214.c @@ -0,0 +1,47 @@ +#include +#define MAX_STR_LEN 101 + + +int str_len(char *s){ + int len = 0; + while(s[len++] != '\0') ; + return len; +} + +char * str_cat(char *t,char *s,int n){ + int i = 0; + int tL = str_len(t); + while(s[i] != '\0' && n-- > 0){ + t[tL + i - 1] = s[i]; + i++; + } + t[tL + i - 1] = '\0'; + return t; +} + + + +int main() +{ + int n; + char s[MAX_STR_LEN], str[MAX_STR_LEN], *p; + while(scanf("%d", &n) != EOF && getchar()) + { + gets(s); + gets(str); + p = str_cat(str, s, n); + puts(p); + puts(str); + } + return 0; +} + +/************************************************************** + Problem: 1214 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1215.c b/QuestionAns/peerin/1215.c new file mode 100644 index 0000000..b12e4b4 --- /dev/null +++ b/QuestionAns/peerin/1215.c @@ -0,0 +1,33 @@ +#include +#define MAX_STR_LEN 101 + +char * str_cpy(char * t,char * s){ + + int idxT = 0, idxS = 0; + while(s[idxS] != '\0') + t[idxT++] = s[idxS++]; + t[idxT] = '\0'; + return t; +} + + +int main() +{ + char s[MAX_STR_LEN], str[MAX_STR_LEN], *p; + while(gets(s) != NULL) + { + p = str_cpy(str, s); + puts(p); + puts(str); + } + return 0; +} +/************************************************************** + Problem: 1215 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1216.c b/QuestionAns/peerin/1216.c new file mode 100644 index 0000000..0e07308 --- /dev/null +++ b/QuestionAns/peerin/1216.c @@ -0,0 +1,36 @@ +#include +#define MAX_STR_LEN 101 + +char * str_cpy(char * t,char * s,int n){ + + int idxT = 0, idxS = 0; + while(idxS < n && s[idxS] != '\0') + t[idxT++] = s[idxS++]; + t[idxT] = '\0'; + return t; +} + + +int main() +{ + int n; + char s[MAX_STR_LEN], str[MAX_STR_LEN], *p; + while(scanf("%d", &n) != EOF && getchar()) + { + gets(s); + p = str_cpy(str, s, n); + puts(p); + puts(str); + } + return 0; +} + +/************************************************************** + Problem: 1216 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1217.c b/QuestionAns/peerin/1217.c new file mode 100644 index 0000000..7b63b84 --- /dev/null +++ b/QuestionAns/peerin/1217.c @@ -0,0 +1,37 @@ +#include + + +int myFloor(double data){ + + if(data==(int)data)return (int)data; + else + return data>0?(int)data:(int)(data-1); + + +} + + +int myCeil(double data){ + if(data==(int)data)return (int)data; + else + return myFloor(data+1); + + +} + +int main() +{ + double data; + while(scanf("%lf", &data) != EOF) + printf("%d %d\n", myFloor(data), myCeil(data)); + return 0; +} +/************************************************************** + Problem: 1217 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1220.c b/QuestionAns/peerin/1220.c new file mode 100644 index 0000000..6fe0cb0 --- /dev/null +++ b/QuestionAns/peerin/1220.c @@ -0,0 +1,58 @@ +#include +#include + +typedef struct{ + int score[10];//选手的10个得分,得分与评委一一对应 + double aver;//选手的平均分 + char name[81];//选手的姓名 +}Choice; + +void inputChoice(Choice peo[],int m,int n){ + for(int i = 0;i < m;++i){ + scanf("%s",peo[i].name); + int max = 0,min = 100,res = 0; + for(int j = 0;j < n;++j){ + scanf("%d",&peo[i].score[j]); + if(peo[i].score[j] > max){ + max = peo[i].score[j]; + } + if(peo[i].score[j] < min){ + min = peo[i].score[j]; + } + res += peo[i].score[j]; + } + //printf("%s max:%d,min:%d\n",peo[i].name,max,min); + peo[i].aver = (res - max - min)/((n - 2) * 1.0); + } +} + +int choiceCmp(const void * n1,const void * n2){ + Choice * p1 = (Choice *)n1; + Choice * p2 = (Choice *)n2; + return -(p1->aver - p2->aver); +} + +void sort(Choice peo[],int m,int n){ + qsort(peo,m,sizeof(Choice),choiceCmp); +} + +int main() +{ + Choice peoples[30]; + int M,N,i; + scanf("%d%d",&M,&N); + inputChoice(peoples,M,N); + sort(peoples,M,N); + for (i=0; i<3; i++) + printf("%s %.2lf\n",peoples[i].name,peoples[i].aver); + return 0; +} +/************************************************************** + Problem: 1220 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1221.c b/QuestionAns/peerin/1221.c new file mode 100644 index 0000000..0461237 --- /dev/null +++ b/QuestionAns/peerin/1221.c @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include + + +int main() +{ + int i, j; + int a; + + scanf("%d", &a); + for (i=0; i + + + +int maxValue(int a,int b,int c){ + + return a>=b?a>=c?a:c:b>=c?b:c; + + + +} + +int main() +{ + int x, y, z; + scanf("%d %d %d", &x, &y, &z); + printf("%d", maxValue(x, y, z)); + return 0; +} +/************************************************************** + Problem: 1224 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1228.c b/QuestionAns/peerin/1228.c new file mode 100644 index 0000000..86c7a67 --- /dev/null +++ b/QuestionAns/peerin/1228.c @@ -0,0 +1,70 @@ +#include +#include +//两个整数的最大公约数等于其中较小的数和两数的差的最大公约数。 +//继续进行同样的计算可以不断缩小这两个数直至其中一个变成零 +//#define MAX 1000 +int min(int a,int b){ +int result; +if(a +#include +/* int is_primer(int num){ */ +/* if(num == 1) */ +/* return 0; */ +/* else if(num == 2 || num == 3 || num ==5 || num == 7) */ +/* return 1; */ +/* else if (num % 2 == 0) */ +/* return 0; */ +/* else if(num % 3 == 0) */ +/* return 0; */ +/* else if(num % 5 == 0) */ +/* return 0; */ +/* else if(num % 7 == 0) */ +/* return 0; */ +/* else */ +/* return 1; */ + + +/* } */ + +int is_primer(int num){ + if(num == 1) + return 0; + int n = sqrt(num); + for(int i = 2;i<=n;++i){ + if(num%i==0) + return 0; + + } + return 1; +} + + +int main() +{ + int num; + while(scanf("%d", &num) != EOF) + { + if(is_primer(num)) + puts("YES"); + else + puts("NO"); + } + return 0; +} +/************************************************************** + Problem: 1233 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:756 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1234.c b/QuestionAns/peerin/1234.c new file mode 100644 index 0000000..074d0b2 --- /dev/null +++ b/QuestionAns/peerin/1234.c @@ -0,0 +1,32 @@ +#include +#include +#define MAX_STR_LEN 101 + +char *revs(char *s){ + int len = strlen(s); + char s2[MAX_STR_LEN]; + for(int i = len - 1;i >= 0;--i){ + s2[i] = s[len - i - 1]; + } + s2[len] = '\0'; + strcpy(s,s2); + return s; +} + +int main() +{ + char s[MAX_STR_LEN]; + gets(s); + revs(s); + puts(s); + return 0; +} +/************************************************************** + Problem: 1234 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1235.c b/QuestionAns/peerin/1235.c new file mode 100644 index 0000000..d7e68fa --- /dev/null +++ b/QuestionAns/peerin/1235.c @@ -0,0 +1,32 @@ +#include +#include +#define MAX_STR_LEN 101 + +char *str_rev(char *t,char *s){ + int len = strlen(s); + for(int i = len - 1;i >= 0;--i){ + t[i] = s[len - i - 1]; + } + t[len] = '\0'; + return t; +} + + +int main() +{ + char s[MAX_STR_LEN], str[MAX_STR_LEN], *p; + gets(s); + p = str_rev(str, s); + puts(p); + puts(str); + return 0; +} +/************************************************************** + Problem: 1235 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1236.c b/QuestionAns/peerin/1236.c new file mode 100644 index 0000000..ff18859 --- /dev/null +++ b/QuestionAns/peerin/1236.c @@ -0,0 +1,32 @@ +#include + + +int get_int_sum(int *a,int *b){ + + scanf("%d%d",a,b); + return *a+*b; + + +} + +int main() +{ + int n, a, b, i; + scanf("%d", &n); + for(i = 1; i <= n; i++) + { + printf("%d = ", get_int_sum(&a, &b)); + printf("%d + %d\n", a, b); + + } + return 0; +} +/************************************************************** + Problem: 1236 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1238.c b/QuestionAns/peerin/1238.c new file mode 100644 index 0000000..1238ab9 --- /dev/null +++ b/QuestionAns/peerin/1238.c @@ -0,0 +1,18 @@ +#include + +int main(){ +double a,b,c; +scanf("%lf%lf%lf",&a,&b,&c); +printf("%g",a*b*c); +return 0; +} + +/************************************************************** + Problem: 1238 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1240.c b/QuestionAns/peerin/1240.c new file mode 100644 index 0000000..fc2bfc6 --- /dev/null +++ b/QuestionAns/peerin/1240.c @@ -0,0 +1,26 @@ +#include +int put_int_sum(int a,int b){ +if(a == 0 && b ==0) + return 0; +else{ + printf("%d\n",a+b); +return 1; +} +} +int main() +{ + int a, b; + while(scanf("%d%d", &a, &b)) + if(put_int_sum(a, b) == 0) + break; + return 0; +} +/************************************************************** + Problem: 1240 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1241.c b/QuestionAns/peerin/1241.c new file mode 100644 index 0000000..dba2135 --- /dev/null +++ b/QuestionAns/peerin/1241.c @@ -0,0 +1,38 @@ +#include + +int compare(int *min, int *mid, int *max){ + int arr[3]={*min,*mid,*max}; + for(int i = 0;i<3;++i){ + for(int j = i+1;j<3;++j){ + if(arr[j] +#include +#include +unsigned int conv(char input[]){ + + unsigned int input_len = strlen(input); + + unsigned int result = 0; + + for(int i = input_len-1;i >= 0;--i){ + //0101 4 4-(3+1) + // + result += (input[i]-'0')*(int)pow(2.0,(input_len-(i*1.0+1))); + //printf("%u\n",result); + + } + + return result; + +} + + +int main(){ + + char input[33]={0}; + while(scanf("%s",&input)!=EOF){ + + printf("%u\n",conv(input)); + + + } + + return 0; +} + +/************************************************************** + Problem: 1242 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:760 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1244.c b/QuestionAns/peerin/1244.c new file mode 100644 index 0000000..893e444 --- /dev/null +++ b/QuestionAns/peerin/1244.c @@ -0,0 +1,24 @@ +#include + +int main(){ + int sec; + while(scanf("%d",&sec)!=EOF&&sec!=0){ + sec--; + double hour = sec/60.0/60.0; + double min = (sec - (int)hour*3600)/60.0; + int sec_left = sec - (int)hour*3600-(int)min*60; + printf("%02d:%02d:%02d\n",(int)hour,(int)min,sec_left); + + } + return 0; +} + +/************************************************************** + Problem: 1244 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1245.c b/QuestionAns/peerin/1245.c new file mode 100644 index 0000000..e2cd3f7 --- /dev/null +++ b/QuestionAns/peerin/1245.c @@ -0,0 +1,39 @@ +#include + + +void hanoi_tower(int number,int begin,int temp,int destination){ + + if(number == 0){ + ; +} + else { + hanoi_tower(number-1,begin,destination,temp); + printf(" plate %d : from %d to %d\n",number,begin,destination); + hanoi_tower(number-1,temp,begin,destination); + } + +} + +int main(){ + + int number,begin,temp,destination; + int count=0; + while(scanf("%d%d%d%d",&number,&begin,&temp,&destination)!=EOF){ + count++; + printf("case %d :\n",count); + hanoi_tower(number,begin,temp,destination); + printf("\n"); + } + return 0; + +} + +/************************************************************** + Problem: 1245 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1247.c b/QuestionAns/peerin/1247.c new file mode 100644 index 0000000..24ed53f --- /dev/null +++ b/QuestionAns/peerin/1247.c @@ -0,0 +1,53 @@ +#include +#include +#include + +int mystrcmp(char *s,char *t){ + int slen = strlen(s); + int tlen = strlen(t); + if(slen==tlen) + return strcmp(s,t); + else + return slen - tlen; +} + +int main(){ + int N; + scanf("%d",&N); + char *a[50000],t[100001]; + int i,j,len; + for(i = 0;i < N;++i){ + scanf("%s",t); + //gets(t); + //getchar(); + len = strlen(t); + a[i] = (char *)malloc(sizeof(char)*(len+1)); + strcpy(a[i],t); + } + for(i = 0;i < N-1;++i){ + for(j = i + 1;j < N;++j){ + if(mystrcmp(a[i],a[j])>0){ + char *tmp = a[i]; + a[i] = a[j]; + a[j] = tmp; + } + } + } + for(i = 0;i < N;++i){ + printf("%s\n",a[i]); + free(a[i]); + } + return 0; +} + + + +/************************************************************** + Problem: 1247 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:968 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1250.c b/QuestionAns/peerin/1250.c new file mode 100644 index 0000000..ddfa819 --- /dev/null +++ b/QuestionAns/peerin/1250.c @@ -0,0 +1,29 @@ +#include +#include +#include +int main() +{ + int n; + scanf("%d",&n); + int i; + for(i=0;i +#include +#include +int main() +{ + int n; + scanf("%d",&n); + int i; + double x1,y1,x2,y2,x3,y3,a; + for(i=0;i + +int main(){ +int a; +scanf("%d",&a); +printf(" a : %d\n--a : %d\n a-- : %d\n a++ : %d\n++a : %d\n",a,a-1,a,a,a+1); +return 0; +} + +/************************************************************** + Problem: 1252 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1253.c b/QuestionAns/peerin/1253.c new file mode 100644 index 0000000..898304d --- /dev/null +++ b/QuestionAns/peerin/1253.c @@ -0,0 +1,28 @@ +#include +#include + +int main(){ + +char s[11]; +scanf("%s",s); +int k; +scanf("%d",&k); + +int len = strlen(s); +if(k>len) printf("error\n"); +else printf("%c\n",s[k-1]); + +return 0; +} + + + +/************************************************************** + Problem: 1253 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1254.c b/QuestionAns/peerin/1254.c new file mode 100644 index 0000000..0c159a9 --- /dev/null +++ b/QuestionAns/peerin/1254.c @@ -0,0 +1,63 @@ +#include +#include +#include +#include + +int main() +{ + int m,n; + int i,j,l,h; + double sum_hang, sum_lie; + double a[52][12]; + char b[52][8]; + char c[11][8]; + char temp1,temp2; + scanf("%d %d", &m, &n); + for(l=0; l +#define MAX_SIZE 1000 + +int getarray(int arr[]){ + + int size; + scanf("%d",&size); + int i; + for(i = 0;i + +typedef enum{ + diamond = 1,//方块 + club = 2,//梅花 + spade = 3,//黑桃 + heart = 4//红桃 +} Cards; + +typedef struct { + Cards type; + int point; +} Poker; + +int get_card(Poker *pk){ + char cT; + scanf("%c",&cT); + if(cT == ' '){ + scanf("%c",&cT); + } + switch(cT){ + case 'D': + pk->type = heart; + break; + case 'C': + pk->type = spade; + break; + case 'B': + pk->type = club; + break; + case 'A': + pk->type = diamond; + } + scanf("%d",&pk->point); + return 0; +} + +int card_cmp(Poker p1, Poker p2){ + if(p1.point == p2.point){ + if(p1.type == p2.type){ + return 0; + } + else{ + return (p1.type > p2.type) ? 1 : -1; + } + } + else{ + return (p1.point > p2.point) ? 1 : -1; + } +} + + +int main() +{ + Poker tom, jack; + get_card(&tom); + get_card(&jack); + + int result = card_cmp(tom, jack); + if(result > 0) + puts("Tom wins."); + if(result < 0) + puts("Jack wins."); + if(result == 0) + puts("Tie."); +} +/************************************************************** + Problem: 1268 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1271.c b/QuestionAns/peerin/1271.c new file mode 100644 index 0000000..10b033c --- /dev/null +++ b/QuestionAns/peerin/1271.c @@ -0,0 +1,127 @@ +#include + +/* int digit_sum_1(int num){ */ +/* //4294967295 */ +/* if(num>=1&&num<10){ */ +/* return num; */ +/* }else if(num >=10 && num <100){ */ +/* int gw,sw; */ +/* gw = num%10; */ +/* sw = num/10; */ +/* return gw+sw; */ +/* }else if(num>=100&&num<1000){ */ +/* int gw,sw,bw; */ +/* gw = num%10; */ +/* sw = (num/10)%10; */ +/* bw = num/100; */ +/* return gw+sw+bw; */ +/* }else if(num>=1000&&num<10000){ */ +/* int gw,sw,bw,qw; */ +/* gw = num%10; */ +/* sw = (num/10)%10; */ +/* bw = (num/100)%10; */ +/* qw = num/1000; */ +/* return gw+sw+bw+qw; */ +/* }else if(num>=10000&&num<100000){ */ +/* int gw,sw,bw,qw,ww; */ +/* gw = num%10; */ +/* sw = (num/10)%10; */ +/* bw = (num/100)%10; */ +/* qw = (num/1000)%10; */ +/* ww = num/10000; */ +/* return gw+sw+bw+qw+ww; */ +/* }else if(num>=100000&&num<1000000){ */ +/* int gw,sw,bw,qw,ww,sww; */ +/* gw = num%10; */ +/* sw = (num/10)%10; */ +/* bw = (num/100)%10; */ +/* qw = (num/1000)%10; */ +/* ww = (num/10000)%10; */ +/* sww = num/100000; */ +/* return gw+sw+bw+qw+ww+sww; */ +/* }else if(num>=1000000&&num<10000000){ */ +/* int gw,sw,bw,qw,ww,sww,bww; */ +/* gw = num%10; */ +/* sw = (num%10)/10; */ +/* bw = (num/100)%10; */ +/* qw = (num/1000)%10; */ +/* ww = (num/10000)%10; */ +/* sww = (num/100000)%10; */ +/* bww = num/1000000; */ + +/* return gw+sw+bw+qw+ww+sww+bww; */ + +/* }else if(num>=10000000&&num<100000000){ */ +/* int gw,sw,bw,qw,ww,sww,bww,qww; */ +/* gw = num%10; */ +/* sw = (num%10)/10; */ +/* bw = (num/100)%10; */ +/* qw = (num/1000)%10; */ +/* ww = (num/10000)%10; */ +/* sww = (num/100000)%10; */ +/* bww = (num/1000000)%10; */ +/* qww = num/10000000; */ + +/* return gw+sw+bw+qw+ww+sww+bww+qww; */ +/* } */ +/* else if(num>=100000000&&num<1000000000){ */ +/* int gw,sw,bw,qw,ww,sww,bww,qww,yw; */ +/* gw = num%10; */ +/* sw = (num%10)/10; */ +/* bw = (num/100)%10; */ +/* qw = (num/1000)%10; */ +/* ww = (num/10000)%10; */ +/* sww = (num/100000)%10; */ +/* bww = (num/1000000)%10; */ +/* qww = (num/10000000)%10; */ +/* yw = num/100000000; */ + +/* return gw+sw+bw+qw+ww+sww+bww+qww+yw; */ +/* }else if(num>=1000000000&&num<10000000000u){ */ +/* int gw,sw,bw,qw,ww,sww,bww,qww,yw,syw; */ +/* gw = num%10; */ +/* sw = (num%10)/10; */ +/* bw = (num/100)%10; */ +/* qw = (num/1000)%10; */ +/* ww = (num/10000)%10; */ +/* sww = (num/100000)%10; */ +/* bww = (num/1000000)%10; */ +/* qww = (num/10000000)%10; */ +/* yw = (num/100000000)%10; */ +/* syw = num/1000000000; */ + +/* return gw+sw+bw+qw+ww+sww+bww+qww+yw+syw; */ +/* } */ +/* } */ + +int digit_sum_1(int num){ + if(num<10) + return num; + else + return num%10+digit_sum_1(num/10); + +} +int digit_sum(int num){ + if(num < 10) + return num; + else + return digit_sum(digit_sum_1(num)); + +} + +int main() +{ + int n; + scanf("%d", &n); + printf("%d", digit_sum(n)); + return 0; +} +/************************************************************** + Problem: 1271 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1276.c b/QuestionAns/peerin/1276.c new file mode 100644 index 0000000..2f807ed --- /dev/null +++ b/QuestionAns/peerin/1276.c @@ -0,0 +1,70 @@ +#include + +int print_line(int total_num,int blank_num){ + + int half_star_num =(total_num - blank_num)/2; + for(int i = 0;i=0;--i){ + if(i==0){ + for(int j = 0;j + + +int is_daffodil(int n){ + if(n<100||n>=1000)return 0; + + int gw = n%10; + int sw = (n/10)%10; + int bw = (n/100); + if(n == gw*gw*gw+sw*sw*sw+bw*bw*bw){ + + return 1; + + }else return 0; + + + + + +} + + +int main() +{ + int n; + scanf("%d", &n); + printf("%s", + ( is_daffodil(n) ? "Yes, it is a daffodil." + : "No, it is not a daffodil." ) + ); + return 0; +} +/************************************************************** + Problem: 1278 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1286.c b/QuestionAns/peerin/1286.c new file mode 100644 index 0000000..d8eef95 --- /dev/null +++ b/QuestionAns/peerin/1286.c @@ -0,0 +1,60 @@ +#include +#define MAX_SIZE 101 + +int get_matrix(int ma[][MAX_SIZE], int m, int n) +{ + int i, j; + for (i = 0; i < m; i++) + for (j = 0; j < n; j++) + scanf("%d", &ma[i][j]); +} + +int put_matrix(int ma[][MAX_SIZE], int m, int n) +{ + int i, j; + for (i = 0; i < m; i++) { + for (j = 0; j < n; j++) + if (j == 0) + printf("%d", ma[i][j]); + else + printf(" %d", ma[i][j]); + printf("\n"); + } +} + +int mul_matrix(int pr[][MAX_SIZE], int m1[][MAX_SIZE], int m2[][MAX_SIZE], int m, int n, int q) +{ + int i, j, k; + for (i = 0; i < m; i++) + for (j = 0; j < q; j++) { + pr[i][j] = 0; + for (k = 0; k < n; k++) + pr[i][j] += (m1[i][k] * m2[k][j]); + } +} + + +int main() +{ + int m, n, q; + int product[MAX_SIZE][MAX_SIZE]; + int matrix1[MAX_SIZE][MAX_SIZE]; + int matrix2[MAX_SIZE][MAX_SIZE]; + + scanf("%d%d%d", &m, &n, &q); + get_matrix(matrix1, m, n); + get_matrix(matrix2, n, q); + mul_matrix(product, matrix1, matrix2, m, n, q); + put_matrix(product, m, q); + + return 0; +} +/************************************************************** + Problem: 1286 + User: 202211070518 + Language: C + Result: Accepted + Time:20 ms + Memory:796 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1298.c b/QuestionAns/peerin/1298.c new file mode 100644 index 0000000..63c875a --- /dev/null +++ b/QuestionAns/peerin/1298.c @@ -0,0 +1,32 @@ +#include +int gcd(int m,int n){ + if(m==0) + return n; + else if(n==0) + return m; + else if(m%n==0){ + return n; + }else{ + return gcd(n,m%n); + } +} +int lcm(int m,int n){ + return m/gcd(m,n)*n; +} + +int main(){ + + int m,n; + scanf("%d%d",&m,&n); + printf("%d %d",gcd(m,n),lcm(m,n)); +} + +/************************************************************** + Problem: 1298 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1301.c b/QuestionAns/peerin/1301.c new file mode 100644 index 0000000..69cc0d4 --- /dev/null +++ b/QuestionAns/peerin/1301.c @@ -0,0 +1,92 @@ +#include +#include +#include +#include + + +char a[109]; + +int sum2(int k) +{ + int u,ne=1,s=0; + for(u=k-1;u>=0;--u) + { + s=s+(a[u]-'0')*ne; + ne=ne*10; + } + return s; +} + +int sum3(int k,int m) +{ + int u,ne=1,s=0; + for(u=k-1;u>m;--u) + { + s=s+(a[u]-'0')*ne; + ne=ne*10; + } + return s; +} +int main() +{ + + while(gets(a)!=NULL) + { + int sum[10],m=0,i,k; + int l=strlen(a); + int flag3=0; + for(i=0; i='0')); + else + { + // printf("NO\n"); + flag3=1; + } + if(a[i]=='.') + { + sum[m]=i; + ++m; + } + } + if(flag3==1) + { + printf("NO\n"); + continue; + } + if(m!=3) + { + printf("NO\n"); + continue; + } + if(sum[1]-sum[0]<=4&&sum[1]-sum[0]>=2 && sum[0]>=1 && sum[0]<=3 && sum[2]-sum[1]<=4&&sum[2]-sum[1]>=2 && l-sum[2]>=2 &&l-sum[2]<=4); + else + { + printf("NO\n"); + continue; + } + int flag=0; + int v=0; + for(k=0;k<=3;++k) + { + if(k==0) v=sum2(sum[k]); + else if(k==3) v=sum3(l,sum[2]); + else v=sum3(sum[k],sum[k-1]); + if(v>=0 && v<=255) flag++; + } + if(flag==4) printf("YES\n"); + else printf("NO\n"); + } + +} + + +/************************************************************** + Problem: 1301 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1334.c b/QuestionAns/peerin/1334.c new file mode 100644 index 0000000..2fc07ec --- /dev/null +++ b/QuestionAns/peerin/1334.c @@ -0,0 +1,39 @@ +#include +#include +#include + +int main() +{ + int N, i = 0, j, l, m; + char** str; + char* t; + char tp[100001]; + scanf("%d", &N); + getchar(); + str = (char**)malloc(sizeof(char*) * (N + 1)); + for (i = 0; i < N; i++) { + gets(tp); + l = strlen(tp); + str[i] = (char*)malloc(sizeof(char) * (l + 1)); + strcpy(str[i], tp); + } + for (i = 0; i < N - 1; i++) + for (j = 0; j < N - 1 - i; j++) + if (strcmp(str[j], str[j + 1]) > 0) { + t = str[j]; + str[j] = str[j + 1]; + str[j + 1] = t; + } + for (i = 0; i < N; i++) + puts(str[i]); +} + +/************************************************************** + Problem: 1334 + User: 202211070518 + Language: C + Result: Accepted + Time:6532 ms + Memory:1356 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1337.c b/QuestionAns/peerin/1337.c new file mode 100644 index 0000000..a48c11c --- /dev/null +++ b/QuestionAns/peerin/1337.c @@ -0,0 +1,34 @@ +#include +#define MAX_STR_LEN 1001 + +int str_chr(char s[], char ch){ + + for(int idx = 0;s[idx] != '\0';++idx){ + if(s[idx] == ch) + return idx; + } + return -1; +} + + +int main() +{ + char ch; + char s[MAX_STR_LEN]; + while(gets(s) != NULL) + { + ch = getchar(); + printf("%d\n", str_chr(s, ch)); + gets(s); // 仅用于读出字符后的换行符,以确保while循环内gets读到正确的数据,无其他意义,于理解题意无关。 + } + return 0; +} +/************************************************************** + Problem: 1337 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1347.c b/QuestionAns/peerin/1347.c new file mode 100644 index 0000000..f022fda --- /dev/null +++ b/QuestionAns/peerin/1347.c @@ -0,0 +1,54 @@ +#include +#include +int main(){ +char c; +scanf("%c",&c); +switch(c){ +case 'a': + printf("yes"); + break; +case 'e': + printf("yes"); + break; + + case 'i': + + printf("yes"); + break; + case 'o': + printf("yes"); + break; + case 'u': + printf("yes"); + break; + case 'A': + printf("yes"); + break; + case 'E': + printf("yes"); + break; + case 'I': + printf("yes"); + break; + case 'O': + printf("yes"); + break; + case 'U': + printf("yes"); + break; + default: + printf("no"); +} + +return 0; +} + +/************************************************************** + Problem: 1347 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1368.c b/QuestionAns/peerin/1368.c new file mode 100644 index 0000000..379a459 --- /dev/null +++ b/QuestionAns/peerin/1368.c @@ -0,0 +1,55 @@ +#include +struct CPLX{ + int real; + int virtual; +}; + +void get_cplx(struct CPLX *cplx){ + scanf("%d%d",&cplx->real,&cplx->virtual); +} + +void put_cplx(struct CPLX cplx){ + printf("%d %d\n",cplx.real,cplx.virtual); +} + +struct CPLX add_cplx(struct CPLX n1,struct CPLX n2){ + struct CPLX res = { + n1.real + n2.real, + n1.virtual + n2.virtual + }; + return res; +} + +struct CPLX sub_cplx(struct CPLX n1,struct CPLX n2){ + struct CPLX res = { + n1.real - n2.real, + n1.virtual - n2.virtual + }; + return res; +} + + + +int main() +{ + struct CPLX ab, cd; + int cases; + scanf("%d", &cases); + while(cases--) + { + get_cplx(&ab); + get_cplx(&cd); + put_cplx( add_cplx(ab, cd) ); + put_cplx( sub_cplx(ab, cd) ); + } + return 0; +} +/************************************************************** + Problem: 1368 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1370.c b/QuestionAns/peerin/1370.c new file mode 100644 index 0000000..fb381cc --- /dev/null +++ b/QuestionAns/peerin/1370.c @@ -0,0 +1,43 @@ +#include +#include +#define MAX_STR_LEN 101 + +char * str_cat(char *t,char *s){ + int idx = 0,idx2 = 0; + char *n = malloc(sizeof(char) * MAX_STR_LEN * 2); + while(t[idx] != '\0'){ + n[idx] = t[idx]; + idx++; + } + + while(s[idx2] != '\0'){ + n[idx + idx2] = s[idx2]; + idx2++; + } + n[idx + idx2] = '\0'; + return n; +} + + +int main() +{ + char s[MAX_STR_LEN], str[MAX_STR_LEN], *p; + while(gets(s) != NULL && gets(str) != NULL) + { + p = str_cat(str, s); + puts(str); + puts(s); + puts(p); + free(p); + } + return 0; +} +/************************************************************** + Problem: 1370 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1375.c b/QuestionAns/peerin/1375.c new file mode 100644 index 0000000..436c7d6 --- /dev/null +++ b/QuestionAns/peerin/1375.c @@ -0,0 +1,25 @@ +#include +int add(int n){ +static sum = 0; +sum += n; +return sum; +} + +int main() +{ + int min, max, sum; + scanf("%d%d", &min, &max); + while(min <= max) + sum = add(min++); + printf("%d", sum); + return 0; +} +/************************************************************** + Problem: 1375 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1376.c b/QuestionAns/peerin/1376.c new file mode 100644 index 0000000..0e24d43 --- /dev/null +++ b/QuestionAns/peerin/1376.c @@ -0,0 +1,51 @@ +#include +#define MAX_SIZE 100 + +int get_array(int a[]){ + int i = 0; + while(scanf("%d",a+i++)!=EOF) ; + return i-1; +} + +int put_array(int a[],int n){ + for(int i = 0;i + + +int get_num(int *a,int *b,int *c){ + + return scanf("%d %d %d",a,b,c); + +} + +int max_min(int *max,int *min,int a,int b,int c){ + + *max = a; + *min = a; + + int ar[3]={a,b,c}; + int i; + for(i = 0;i < 3;++i){ + if(ar[i]>*max){ + *max = ar[i]; + } + if(ar[i]<*min){ + *min = ar[i]; + } + } + + return 0; +} + + +int main() +{ + int cases, i; + int mmax, mmin, a, b, c; + + scanf("%d", &cases); + for(i = 1; i <= cases; i++) + { + get_num(&a, &b, &c); + max_min(&mmax, &mmin, a, b, c); + printf("case %d : %d, %d\n", i, mmax, mmin); + } +} + +/************************************************************** + Problem: 1382 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1383.c b/QuestionAns/peerin/1383.c new file mode 100644 index 0000000..96c586f --- /dev/null +++ b/QuestionAns/peerin/1383.c @@ -0,0 +1,69 @@ +#include +#include + +double * allocate(int n){ + + return (double *)malloc(sizeof(double)*n); + +} + +void output(double *p, int N){ + int m,n; + scanf("%d%d",&m,&n); + if(m>n){ + int temp = m; + m = n; + n = temp; + } + int f = 0,bg,ed; + if(m<1) + bg = 0; + else + bg = m-1; + if(n>N) + ed = N; + else + ed = n; + + int i; + for(i = bg;i < ed;++i){ + f = 1; + printf("%g\n",p[i]); + } + if(f==0){ + printf("no output\n"); + } + +} + +void input(double *p, int N){ + int i; + for(i = 0;i < N;++i){ + scanf("%lf",p+i); + } +} + +void release(double *p){ + free(p); +} + + +int main() +{ + int len; + double *array; + scanf("%d", &len); + array = allocate(len); + input(array, len); + output(array, len); + release(array); +} +/************************************************************** + Problem: 1383 + User: 202211070518 + Language: C + Result: Accepted + Time:68 ms + Memory:3092 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1384.c b/QuestionAns/peerin/1384.c new file mode 100644 index 0000000..2df2c13 --- /dev/null +++ b/QuestionAns/peerin/1384.c @@ -0,0 +1,30 @@ +#include +int jc(int n){ + if(n<=1){ + return 1; + }else{ + return n*jc(n-1); + } + + +} + + + +int main(){ + int n; + scanf("%d",&n); + printf("%d",jc(n)); + + return 0; +} + +/************************************************************** + Problem: 1384 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1398.c b/QuestionAns/peerin/1398.c new file mode 100644 index 0000000..5be9ad4 --- /dev/null +++ b/QuestionAns/peerin/1398.c @@ -0,0 +1,19 @@ +#include + +int main(){ + +printf("Hello world!\n"); + + +return 0; +} + +/************************************************************** + Problem: 1398 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:744 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1400.c b/QuestionAns/peerin/1400.c new file mode 100644 index 0000000..dab0b1e --- /dev/null +++ b/QuestionAns/peerin/1400.c @@ -0,0 +1,18 @@ +#include + +int main(){ +int a,b; +scanf("%d%d",&a,&b); +printf("%d\n%d",a+b,a-b); +return 0; +} + +/************************************************************** + Problem: 1400 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1403.c b/QuestionAns/peerin/1403.c new file mode 100644 index 0000000..9b1ec55 --- /dev/null +++ b/QuestionAns/peerin/1403.c @@ -0,0 +1,27 @@ +#include +#include +int main(){ +double n; +scanf("%lf",&n); +double n_ = sqrt(n); +if(n_==(int)n_){ + if((int)n%2==0){ + if(n>0){ + printf("yes"); +return 0; + } + } +} +printf("no"); +return 0; +} + +/************************************************************** + Problem: 1403 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:756 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1404.c b/QuestionAns/peerin/1404.c new file mode 100644 index 0000000..8ee93e1 --- /dev/null +++ b/QuestionAns/peerin/1404.c @@ -0,0 +1,25 @@ +#include +#include +int main(){ +int P_1,P_2,P_3,P_s; +int R_1,R_2,R_3; +scanf("%d%d%d%d",&P_1,&P_2,&P_3,&P_s); +scanf("%d%d%d",&R_1,&R_2,&R_3); +if(R_1 +#include +#include +int main(){ +int k,s,n; +scanf("%d",&k); +s = 0; +int i = 0; +for(i = 0;i +#include +#include +int main(){ + int n,sum; + sum = 0; + int count = 0; +while(scanf("%d",&n)!=EOF){ + sum+=n; + count++; +} +printf("%.3f",sum/(double)count); +return 0; +} + +/************************************************************** + Problem: 1417 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1434.c b/QuestionAns/peerin/1434.c new file mode 100644 index 0000000..f3b491a --- /dev/null +++ b/QuestionAns/peerin/1434.c @@ -0,0 +1,65 @@ +#include +#include + +int main() +{ + int m, n, i, j, k, kp; + double t; + double a[51][51], b[51], c[51]; + scanf("%d", &m); + for (kp = 1; kp <= m; kp++) { + scanf("%d", &n); + for (j = 1; j <= n; j++) { + for (i = 1; i <= n; i++) { + scanf("%lf", &a[j][i]); + } + scanf("%lf", &b[j]); + } + if (kp != 1) + printf("\n"); + for (j = 1; j <= n - 1; j++) { + if (a[j][j] == 0) { + for (i = j + 1; i <= n; i++) { + if (a[i][j] != 0) { + for (k = 1; k <= n; k++) { + a[i][k] += a[j][k]; + a[j][k] = a[i][k] - a[j][k]; + a[i][k] -= a[j][k]; + } + b[i] += b[j]; + b[j] = b[i] - b[j]; + b[i] -= b[j]; + } + continue; + } + } + } + for (j = 1; j <= n - 1; j++) { + for (i = j + 1; i <= n; i++) { + t = a[i][j] / a[j][j]; + b[i] = b[i] - t * b[j]; + for (k = 1; k <= n; k++) + a[i][k] = a[i][k] - t * a[j][k]; + } + } + + c[n] = b[n] / a[n][n]; + for (j = n - 1; j >= 1; --j) { + c[j] = b[j]; + for (k = n; k >= j + 1; --k) + c[j] = c[j] - c[k] * a[j][k]; + c[j] = c[j] / a[j][j]; + } + for (j = 1; j <= n; ++j) + printf("x%d=%.3lf\n", j, c[j]); + } +} +/************************************************************** + Problem: 1434 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1455.c b/QuestionAns/peerin/1455.c new file mode 100644 index 0000000..2203d16 --- /dev/null +++ b/QuestionAns/peerin/1455.c @@ -0,0 +1,27 @@ +#include + +int main(){ + /* int sec; */ + /* while(scanf("%d",&sec)!=EOF&&sec!=0){ */ + /* double hour = sec/60.0/60.0; */ + /* double min = (sec - (int)hour*3600)/60.0; */ + /* int sec_left = sec - (int)hour*3600-(int)min*60; */ + /* printf("%d:%d:%d",(int)hour,(int)min,sec_left); */ + + /* } */ + int hour,min,sec; + while (scanf("%d:%d:%d",&hour,&min,&sec)!=EOF){ + printf("%d\n",hour*3600+min*60+sec+1); + } + return 0; +} + +/************************************************************** + Problem: 1455 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1457.c b/QuestionAns/peerin/1457.c new file mode 100644 index 0000000..cfabe4a --- /dev/null +++ b/QuestionAns/peerin/1457.c @@ -0,0 +1,55 @@ +#include + +void prsp(int n) +{ + int i; + for (i = 1; i <= n; i++) { + printf(" "); + } +} + +void prsz(int n) +{ + int i; + for (i = 1; i <= n; i++) { + printf("%d", i); + } + for (i -= 2; i >= 1; i--) { + printf("%d", i); + } +} + +int main() +{ + int i, n; + scanf("%d", &n); + for (i = 1; i <= n; i++) { + prsp(n - i); + prsz(i); + printf("\n"); + } + for (i -= 2; i >= 1; i--) { + prsp(n - i); + prsz(i); + printf("\n"); + } +} +/************************************************************** + Problem: 1457 + User: 202001060117 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + + +/************************************************************** + Problem: 1457 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1458.c b/QuestionAns/peerin/1458.c new file mode 100644 index 0000000..f7b3a6e --- /dev/null +++ b/QuestionAns/peerin/1458.c @@ -0,0 +1,32 @@ +#include + +int main(){ + int n; + scanf("%d",&n); + int i; + int array[n]; +for(i = 0;in-1||index < 1)printf("OUT OF RANGE\n"); + else{ + printf("%d\n",array[index-1]); + + } + + } + + +} + +/************************************************************** + Problem: 1458 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1459.c b/QuestionAns/peerin/1459.c new file mode 100644 index 0000000..9c608be --- /dev/null +++ b/QuestionAns/peerin/1459.c @@ -0,0 +1,54 @@ +#include + + + +int find(int list[],int num,int len){ + + /* if(list[len/2]==num)return list[len/2]; */ + /* else if(len==0){return -1;} */ + /* else{ */ + /* return find(list,num,len/2); */ + /* } */ + + + for(int i = 0;i < len;++i){ + if(list[i]==num)return i+1; + } + return -1; +} + + + +int main(){ + + int n; + scanf("%d",&n); + int list[n]; + for(int i = 0;i + +int find(int list[],int num,int len){ + + for(int i = len-1;i >= 0;--i){ + if(list[i]==num)return i+1; + } + return -1; +} + + + +int main(){ + + int n; + scanf("%d",&n); + int list[n]; + for(int i = 0;i + + + +int main(){ + + int n; + scanf("%d",&n); + int list[n]; + for(int i = 0;i=0?i:-i)>n?-1:list[i>0?i-1:n+i]; + if(res==-1){ + printf("OUT OF RANGE\n"); + }else{ + printf("%d\n",res); + } + + } +} + +/************************************************************** + Problem: 1461 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1462.c b/QuestionAns/peerin/1462.c new file mode 100644 index 0000000..3bde7fa --- /dev/null +++ b/QuestionAns/peerin/1462.c @@ -0,0 +1,60 @@ +#include +/* int find(int list[],int num,int begin,int len,int result[],int count){ */ + +/* for(int i = begin;i < len;++i){ */ +/* if(list[i]==num){ */ +/* result[count++]==i; */ +/* } */ + +/* } + + + + }*/ + +int main(){ + + int n; + scanf("%d",&n); + int list[n]; + for(int i = 0;i < n;++i){ + + scanf("%d",list+i); + + } + int num; + while(scanf("%d",&num)!=EOF){ + + int number = 0; + for(int i = 0;i < n;++i){ + if(list[i]==num)number++; + } + int flag = 0; + int count = 0; + for(int i = 0;i < n;++i){ + if(list[i]==num){ + flag = 1; + count++; + if(count != number) + printf("%d ",i+1); + else + printf("%d\n",i+1); + } + } + if(flag == 0){ + printf("NOT FOUND\n"); + } + } + + return 0; +} + +/************************************************************** + Problem: 1462 + User: 202211070518 + Language: C + Result: Accepted + Time:88 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1463.c b/QuestionAns/peerin/1463.c new file mode 100644 index 0000000..2b28d0d --- /dev/null +++ b/QuestionAns/peerin/1463.c @@ -0,0 +1,28 @@ +#include +int sum(int a, int b){ +int result; +result = a+b; + +return result; +} + + +int main() +{ + int a, b; + + while(scanf("%d%d", &a, &b) != EOF) + printf("%d\n", sum(a, b)); + + return 0; +} + +/************************************************************** + Problem: 1463 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1464.c b/QuestionAns/peerin/1464.c new file mode 100644 index 0000000..01b4d86 --- /dev/null +++ b/QuestionAns/peerin/1464.c @@ -0,0 +1,26 @@ +#include +int put_sum(int a,int b){ +printf("%d\n",a+b); + +return 0; +} + + +int main() +{ + int a, b; + + while(scanf("%d%d", &a, &b) != EOF) + put_sum(a, b); + + return 0; +} +/************************************************************** + Problem: 1464 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1465.c b/QuestionAns/peerin/1465.c new file mode 100644 index 0000000..84c57f1 --- /dev/null +++ b/QuestionAns/peerin/1465.c @@ -0,0 +1,27 @@ +#include + +int is_leap_year(int year){ + +return (year%4==0&&year%100!=0)||year%400==0?1:0; + +} + + +int main() +{ + int year; + + scanf("%d", &year); + is_leap_year(year) ? printf("Yes") : printf("No"); + + return 0; +} +/************************************************************** + Problem: 1465 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1466.c b/QuestionAns/peerin/1466.c new file mode 100644 index 0000000..b2c35c6 --- /dev/null +++ b/QuestionAns/peerin/1466.c @@ -0,0 +1,27 @@ +#include +int recursive(){ + char c = getchar(); + if(c!=EOF){ + recursive(); + putchar(c); + }else{ + return 0; + } + +} + +int main() +{ + recursive(); + return 0; +} + +/************************************************************** + Problem: 1466 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:2212 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1468.c b/QuestionAns/peerin/1468.c new file mode 100644 index 0000000..dc6887e --- /dev/null +++ b/QuestionAns/peerin/1468.c @@ -0,0 +1,99 @@ +#include +typedef struct jihe{ + int beginning; + int ending; +}jihe; +jihe find_jiaoji(struct jihe jihe1,struct jihe jihe2){ + struct jihe jiaoji; + + if(jihe2.endingjihe1.ending){ + if(jihe2.beginning<=jihe1.ending){ + if(jihe2.beginning>=jihe1.beginning){ + // |_____jihe2_____| + //|_____jihe1_____| + jiaoji.beginning = jihe2.beginning; + jiaoji.ending = jihe1.ending; + } + else{ + + //|_____jihe2_____| + // |__jihe1__| + jiaoji.beginning = jihe1.beginning; + jiaoji.ending = jihe1.ending; + } + } + else{ + // |_____jihe2_____| + //|_____jihe1_____| + jiaoji.beginning = 0; + jiaoji.ending = 0; + } + } + return jiaoji; +} +int main(){ + + int n; + scanf("%d",&n); + int list[n]; + for(int i = 0;ijihe2.ending){ + int temp = jihe2.beginning; + jihe2.beginning = jihe2.ending; + jihe2.ending = temp; + } + struct jihe jiaoji = find_jiaoji(jihe1,jihe2); + if(jiaoji.beginning==0&&jiaoji.ending==0){ + printf("OUT OF RANGE\n"); + continue; + } + int i = jiaoji.beginning; + int j = jiaoji.ending; + // printf("jiaoji:%d %d\njihe1:%d %d\njihe2:%d %d",i,j,jihe1.beginning,jihe1.ending,jihe2.beginning,jihe2.ending); + for(int temp_i = i;temp_i <= j;++temp_i){ + if(temp_i!=j){ + printf("%d ",list[temp_i-1]); + } + else{ + printf("%d\n",list[temp_i-1]); + } + } + } + return 0; +} + +/************************************************************** + Problem: 1468 + User: 202211070518 + Language: C + Result: Accepted + Time:32 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1469.c b/QuestionAns/peerin/1469.c new file mode 100644 index 0000000..453b82a --- /dev/null +++ b/QuestionAns/peerin/1469.c @@ -0,0 +1,30 @@ +#include +int main(){ + int list[500000]={0}; + int n; + scanf("%d",&n); + for(int i = 0;imax){ + max = list[i]; + } + } + printf("%d",max); + return 0; +} + +/************************************************************** + Problem: 1469 + User: 202211070518 + Language: C + Result: Accepted + Time:68 ms + Memory:2628 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1473.c b/QuestionAns/peerin/1473.c new file mode 100644 index 0000000..2e6d531 --- /dev/null +++ b/QuestionAns/peerin/1473.c @@ -0,0 +1,46 @@ +#include + +int digits_rec(int n,int flag){ + + + if(n==0&&flag==0){ + return 1; + } + else if(n==0&&flag==1) + return 0; + else if(n>0){ + + return 1+digits_rec(n/10,1); + + } + else if(n<0){ + + return 1+digits_rec(n/10,1); + + } + + + +} + + +int digits(int n){ + return digits_rec(n,0); + +} + +int main() +{ + int num; + scanf("%d", &num); + printf("%d\n", digits(num)); +} +/************************************************************** + Problem: 1473 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1487.c b/QuestionAns/peerin/1487.c new file mode 100644 index 0000000..506095f --- /dev/null +++ b/QuestionAns/peerin/1487.c @@ -0,0 +1,38 @@ +#include +#define MAX_STR_LEN 1001 + +char * str_chr(char s[], char ch){ + + for(int idx = 0;s[idx] != '\0';++idx){ + if(s[idx] == ch) + return s + idx; + } + return NULL; +} + + +int main() +{ + char ch; + char s[MAX_STR_LEN], *s1; + while(gets(s) != NULL) + { + ch = getchar(); + s1 = str_chr(s, ch); + if(s1 == NULL) + printf("-1\n"); + else + printf("%d\n", s1 - s); + gets(s); // 仅用于读出字符后的换行符,以确保while循环内gets读到正确的数据,无其他意义,于理解题意无关。 + } + return 0; +} +/************************************************************** + Problem: 1487 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1490.c b/QuestionAns/peerin/1490.c new file mode 100644 index 0000000..f1013ef --- /dev/null +++ b/QuestionAns/peerin/1490.c @@ -0,0 +1,48 @@ +#include +#include +int abs(int n){ + return n>0?n:-n; +} + +int main(){ +int table[50]={2,22,222,3,33,333,4,44,444,5,55,555,6,66,666,7,77,777,7777,8,88,888,9,99,999,9999}; +char s[20001]={0}; +while(fgets(s,20000,stdin)!=NULL){ + char currentCh,lastCh=-10; + int i; + for(i = 0;s[i] != '\0'&&s[i] != '\n';i++){ + currentCh = s[i]; + if(currentCh==' '){ + printf("0"); + lastCh = currentCh; + continue; + } + if(lastCh==-10){ + printf("%d",table[currentCh-'A']); + lastCh=currentCh; + continue; + } + + if((table[lastCh-'A']%10)==(table[currentCh-'A']%10)){ + printf("1%d",table[currentCh-'A']); + lastCh=currentCh; + continue; + } + + printf("%d",table[currentCh-'A']); + lastCh=currentCh; + continue; + + } + printf("\n"); +} +} +/************************************************************** + Problem: 1490 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1494.c b/QuestionAns/peerin/1494.c new file mode 100644 index 0000000..377e57e --- /dev/null +++ b/QuestionAns/peerin/1494.c @@ -0,0 +1,36 @@ +#include + +typedef struct{ + int len; + int num[11000]; +}ARR_TYPE; + +void input_arr(ARR_TYPE *arr){ + scanf("%d",&arr->len); + int i; + for(i=0;ilen;++i){ + scanf("%d",&arr->num[i]); + } +} +void output_arr(ARR_TYPE arr){ + int i; + for(i=0;i +#include +typedef struct{ + double x; + double y; +}POINT; + +void input_point(POINT * pt){ + scanf("%lf %lf",&pt->x,&pt->y); +} + +double distance(POINT pt1,POINT pt2){ + double dx = fabs(pt1.x - pt2.x); + double dy = fabs(pt1.y - pt2.y); + return sqrt(dx * dx + dy * dy); +} + +int main() +{ + POINT p,q; + double dis; + input_point(&p); + input_point(&q); + dis=distance(p,q); + printf("%g",dis); + return 0; +} +/************************************************************** + Problem: 1495 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:756 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1497.c b/QuestionAns/peerin/1497.c new file mode 100644 index 0000000..9467fe2 --- /dev/null +++ b/QuestionAns/peerin/1497.c @@ -0,0 +1,66 @@ +#include + +typedef struct point +{ + int x; + int y; +}POINT; + +typedef struct rect +{ + POINT LeftTop; + POINT RightBottom; +}RECT; + +void getPoint(POINT *p) +{ + scanf("%d %d", &p->x, &p->y); +} + +void getRect(RECT *rc) +{ + scanf("%d %d %d %d", &rc->LeftTop.x, &rc->LeftTop.y, &rc->RightBottom.x, &rc->RightBottom.y); +} + +int judgeRelation(POINT p,RECT rc) +{ + int retval; + if( ((p.x == rc.LeftTop.x || p.x == rc.RightBottom.x) && (p.y <= rc.LeftTop.y && p.y >= rc.RightBottom.y)) + || ((p.y == rc.LeftTop.y || p.y == rc.RightBottom.y) && (p.x >= rc.LeftTop.x && p.x <= rc.RightBottom.x)) ) + retval = 1; + else if(p.x > rc.LeftTop.x && p.x < rc.RightBottom.x && p.y < rc.LeftTop.y && p.y > rc.RightBottom.y) + retval = 2; + else + retval = 3; + return retval; +} + +int main() +{ + POINT p; + RECT rc; + getPoint(&p); + getRect(&rc); + switch (judgeRelation(p,rc)) + { + case 1: + puts("The point is on one edge."); + break; + case 2: + puts("The point is inside the rectangle."); + break; + case 3: + puts("The point is outside the rectangle."); + break; + } + return 0; +} +/************************************************************** + Problem: 1497 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1503.c b/QuestionAns/peerin/1503.c new file mode 100644 index 0000000..da1a71c --- /dev/null +++ b/QuestionAns/peerin/1503.c @@ -0,0 +1,65 @@ +#include + +int get_m(int child,int mom){ + for(int i = 2;i<=child;i++){ + if(child%i==0){ + if(mom%i==0){ + child /= i; + mom /= i; + i--; + } + } + } + return mom; +} + +int get_c(int child,int mom){ + for(int i = 2;i<=child;i++){ + if(child%i==0){ + if(mom%i==0){ + child /= i; + mom /= i; + i--; + } + } + } + return child; +} + +int main(int argc,char *argv[]){ + int child,mom; + while(scanf("%d/%d",&child,&mom)!=EOF){ + int zs = child/mom; + int c,m; + if(zs==0){ + c = get_c(child,mom); + m = get_m(child,mom); + } + else{ + c = get_c(child-mom*zs,mom); + m = get_m(child-mom*zs,mom); + } + + if(zs==0){ + printf("%d/%d\n",c,m); + } + else{ + if(c==0) + printf("%d\n",zs); + + else + printf("%d+%d/%d\n",zs,c,m); + } + } + return 0; +} + +/************************************************************** + Problem: 1503 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1508.c b/QuestionAns/peerin/1508.c new file mode 100644 index 0000000..47c0b57 --- /dev/null +++ b/QuestionAns/peerin/1508.c @@ -0,0 +1,58 @@ +#include +#define maxlen 1000 + +int sort(int array[],int len){ + + for(int i = 0;i +#include +int main(){ + char a; + int list[56]={0}; + //0 digits + //1 spacse + //2 puncts + //3-28 a-z + //29-55 A-Z + while((a = getchar())!=EOF){ + if(isdigit(a))list[0]++; + else if(islower(a))list[3+a-'a']++; + else if(isupper(a))list[29+a-'A']++; + else if(isspace(a))list[1]++; + else if(ispunct(a))list[2]++; + } + int sum_lower = 0; + int sum_upper = 0; + for(int i = 3;i<=28;++i){ + sum_lower+=list[i]; + } + for(int i = 29;i<=55;++i){ + sum_upper+=list[i]; + + } + int sum = list[0]+list[1]+list[2]+sum_lower+sum_upper; + + + printf("All Characters : %d\nLowers : %d\nUppers : %d\nDigits : %d\nSpaces : %d\nPuncts : %d\n",sum,sum_lower,sum_upper,list[0],list[1],list[2]); + for(char c = 'A';c <= 'Z';++c){ + printf("%c : %d\n",c,list[3+c-'A']+list[29+c-'A']); + } + return 0; +} + +/************************************************************** + Problem: 1509 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1511.c b/QuestionAns/peerin/1511.c new file mode 100644 index 0000000..f26d2fd --- /dev/null +++ b/QuestionAns/peerin/1511.c @@ -0,0 +1,66 @@ +#include +#include + +struct fraction { + int numerator; // 分子 + int denominator; // 分母 + int symbol; // 符号,分子为负时取值为-1,为正时取值为1,其它取值无意义 +}; + +int gcd(int a, int b) +{ + if (a == 0) + return b; + return gcd(b % a, a); +} + +int scan_frac(struct fraction* f, struct fraction* g) +{ + return scanf("%d/%d*%d/%d", &(f->numerator), &(f->denominator), &(g->numerator), &(g->denominator)); +} + +struct fraction multiply_frac(struct fraction f, struct fraction g) +{ + struct fraction jg; + int gbs; + jg.numerator = f.numerator * g.numerator; + jg.denominator = f.denominator * g.denominator; + if (jg.numerator < 0 || jg.denominator < 0) { + jg.symbol = -1; + jg.numerator = abs(jg.numerator); + jg.denominator = abs(jg.denominator); + } else + jg.symbol = 1; + gbs = gcd(jg.numerator, jg.denominator); + jg.numerator /= gbs; + jg.denominator /= gbs; + return jg; +} + + +int main() +{ + struct fraction f1, f2, product; + while(scan_frac(&f1, &f2) != EOF) + { + product = multiply_frac(f1, f2); + if(product.numerator == 0) + { + printf("0\n"); + continue; + } + if(product.symbol == -1) + printf("-"); + printf("%d/%d\n", product.numerator, product.denominator); + } + return 0; +} +/************************************************************** + Problem: 1511 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1512.c b/QuestionAns/peerin/1512.c new file mode 100644 index 0000000..ba99b94 --- /dev/null +++ b/QuestionAns/peerin/1512.c @@ -0,0 +1,32 @@ +#include +int ackermann_rec(int m,int n){ + if(m==0){ + return n+1; + } + else if(m>0 && n==0){ + return ackermann_rec(m-1,1); + } + else{ + return ackermann_rec(m-1,ackermann_rec(m,n-1)); + } + + +} +int main(){ + + int m,n; + scanf("%d %d",&m,&n); + printf("A(%d, %d) = %d",m,n,ackermann_rec(m,n)); + + return 0; +} + +/************************************************************** + Problem: 1512 + User: 202211070518 + Language: C + Result: Accepted + Time:1160 ms + Memory:1292 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1561.c b/QuestionAns/peerin/1561.c new file mode 100644 index 0000000..c1ea461 --- /dev/null +++ b/QuestionAns/peerin/1561.c @@ -0,0 +1,59 @@ +#include + +typedef struct +{ + int x; + int y; +} point,vector; +int rtCross(vector l1,vector l2) +{//l1.x*(-l2.y) - (-l2.x)*l1.y; + return -l1.x*l2.y + l2.x*l1.y; +} +int isConvex(point a1,point a2,point a3,point a4) +{ + vector l1,l2,l3,l4; + l1.x = a1.x - a2.x; + l1.y = a1.y - a2.y; + l2.x = a2.x - a3.x; + l2.y = a2.y - a3.y; + l3.x = a3.x - a4.x; + l3.y = a3.y - a4.y; + l4.x = a4.x - a1.x; + l4.y = a4.y - a1.y; + if(rtCross(l1,l2)>0 && rtCross(l2,l3)>0 && rtCross(l3,l4)>0 && rtCross(l4,l1)>0) + return 1; + else if(rtCross(l1,l2)<0 && rtCross(l2,l3)<0 && rtCross(l3,l4)<0 && rtCross(l4,l1)<0) + return 1; + else return 0; +} +int main() +{ + int n; + point a1,a2,a3,a4; + int i; + scanf("%d",&n); + for(i=1; i<=n; ++i) + { + scanf("%d%d",&a1.x,&a1.y); + scanf("%d%d",&a2.x,&a2.y); + scanf("%d%d",&a3.x,&a3.y); + scanf("%d%d",&a4.x,&a4.y); + printf("Case %d: ",i); + if(isConvex(a1,a2,a3,a4)) + printf("convex\n"); + else + printf("concave\n"); + } + return 0; +} + + +/************************************************************** + Problem: 1561 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1586.c b/QuestionAns/peerin/1586.c new file mode 100644 index 0000000..645f416 --- /dev/null +++ b/QuestionAns/peerin/1586.c @@ -0,0 +1,56 @@ +#include +#define MAX_SIZE 100 + +int get_matrix(int ma[MAX_SIZE][MAX_SIZE],int m,int n){ + for(int i = 0;i < m;++i) + for(int j = 0;j < n;++j) + scanf("%d",&ma[i][j]); + return 0; +} + +int put_array(int a[],int n){ + for(int i = 0;i < n;++i){ + if(i == 0) + printf("%d",a[i]); + else + printf(" %d",a[i]); + } + printf("\n"); +} + +int count_sum(int a[],int ma[MAX_SIZE][MAX_SIZE],int m,int n){ + for(int i = 0;i < m;++i){ + int res = 0; + for(int j = 0;j < n;++j){ + res += ma[i][j]; + } + a[i] = res; + } + return 0; +} + + +int main() +{ + int i, cases, sum[MAX_SIZE]; + int m, n, matrix[MAX_SIZE][MAX_SIZE]; + scanf("%d", &cases); + for(i = 1; i <= cases; i++) + { + scanf("%d%d", &m, &n); + get_matrix(matrix, m, n); + count_sum(sum, matrix, m, n); + printf("case %d:", i); + put_array(sum, m); + } + return 0; +} +/************************************************************** + Problem: 1586 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1593.c b/QuestionAns/peerin/1593.c new file mode 100644 index 0000000..b69da0d --- /dev/null +++ b/QuestionAns/peerin/1593.c @@ -0,0 +1,62 @@ +#include +#define MAX_SIZE 100 + +int get_matrix(int ma[MAX_SIZE][MAX_SIZE],int m,int n){ + for(int i = 0;i < m;++i) + for(int j = 0;j < n;++j) + scanf("%d",&ma[i][j]); + return 0; +} + +int put_array(double a[],int n){ + for(int i = 0;i < n;++i){ + if(i == 0) + printf("%lg",a[i]); + else + printf(" %lg",a[i]); + } + printf("\n"); + return 0; +} + +double aver(int sum,int n){ + return sum/(n * 1.0); +} + +int count_sum(double a[],int ma[MAX_SIZE][MAX_SIZE],int m,int n){ + for(int i = 0;i < n;++i){ + int res = 0; + for(int j = 0;j < m;++j){ + res += ma[j][i]; + } + a[i] = aver(res,m); + } + return 0; +} + +int main() +{ + int i, cases; + double sum[MAX_SIZE]; + int m, n, matrix[MAX_SIZE][MAX_SIZE]; + scanf("%d", &cases); + for(i = 1; i <= cases; i++) + { + scanf("%d%d", &m, &n); + get_matrix(matrix, m, n); + count_sum(sum, matrix, m, n); + printf("case %d:", i); + put_array(sum, n); + } + return 0; +} + +/************************************************************** + Problem: 1593 + User: 202211070518 + Language: C + Result: Accepted + Time:12 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1607.c b/QuestionAns/peerin/1607.c new file mode 100644 index 0000000..32ee06f --- /dev/null +++ b/QuestionAns/peerin/1607.c @@ -0,0 +1,29 @@ +#include + +int get_nums(int *n){ + *n = 0; + int nu; + while(scanf("%d",&nu)!=EOF){ + (*n)++; + //printf("%d\n",nu); + } + return 0; +} + + +int main() +{ + int n; + get_nums(&n); + printf("%d\n", n); +} + +/************************************************************** + Problem: 1607 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1611.c b/QuestionAns/peerin/1611.c new file mode 100644 index 0000000..a49bd02 --- /dev/null +++ b/QuestionAns/peerin/1611.c @@ -0,0 +1,37 @@ +#include + +int get_array(int a[]){ + int size; + scanf("%d",&size); + int i; + for(i = 0;i < size;++i){ + scanf("%d",a+i); + } + return size; +} + + int array_value(int a[],int n,int k){ + if(k<0){ + k = n+k; + } + return a[k]; + } + + +int main() +{ + int size, arr[1000], m, k; + size = get_array(arr); + while(scanf("%d", &k) != EOF) + printf("%d\n", array_value(arr, size, k)); + return 0; +} +/************************************************************** + Problem: 1611 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1633.c b/QuestionAns/peerin/1633.c new file mode 100644 index 0000000..af25d4c --- /dev/null +++ b/QuestionAns/peerin/1633.c @@ -0,0 +1,51 @@ +#include +#include +#include +#include +#define MAX_SIZE 10009 +int g(int k,int x) +{ + if(x==0 ) return 1; + int t=1,d=1; + int i,j; + j=x; + for(i=0;i0;--j) printf(" "); + for(k=0;k +#include +#define MAX_LINE 100 +#define MAX_ROW 100 + +void getMatrix(int ma[MAX_LINE][MAX_ROW],int m,int n){ + + for(int i = 0;i < m;++i) + for(int j = 0;j < n;++j) + scanf("%d",&ma[i][j]); + +} + +void putMatrix(int ma[MAX_LINE][MAX_ROW],int m,int n){ + + for(int i = 0;i < m;++i){ + for(int j = 0;j < n;++j){ + if(j == 0) + printf("%d",ma[i][j]); + else + printf(" %d",ma[i][j]); + } + printf("\n"); + } +} + +void lineSwitch(int ma[MAX_LINE][MAX_ROW],int line1,int line2,int n){ + + int tmp[MAX_ROW]; + + for(int j = 0;j < n;++j) + tmp[j] = ma[line1][j]; + + for(int j = 0;j < n;++j) + ma[line1][j] = ma[line2][j]; + + for(int j = 0;j < n;++j) + ma[line2][j] = tmp[j]; + + + +} + + +void rowSwitch(int ma[MAX_LINE][MAX_ROW],int row1,int row2,int m){ + + int tmp[MAX_LINE]; + + for(int j = 0;j < m;++j) + tmp[j] = ma[j][row1]; + + for(int j = 0;j < m;++j) + ma[j][row1] = ma[j][row2]; + + for(int j = 0;j < m;++j) + ma[j][row2] = tmp[j]; + + +} + + +int main(int argc,char *argv[]){ + + int m,n; + int ma[MAX_LINE][MAX_ROW]; + scanf("%d%d",&m,&n); + getMatrix(ma,m,n); + //int maB[MAX_LINE][MAX_ROW]; + // memcpy(maB,ma,MAX_LINE * MAX_ROW * sizeof(int)); + char choice[10]; + int c1,c2; + while(scanf("%s%d%d",choice,&c1,&c2) != EOF){ + if(!strcmp(choice,"line")) + lineSwitch(ma,c1,c2,n); + else if(!strcmp(choice,"row")) + rowSwitch(ma,c1,c2,m); + putMatrix(ma,m,n); + printf("\n"); + //memcpy(ma,maB,MAX_LINE * MAX_ROW * sizeof(int)); + } + + return 0; +} + +/************************************************************** + Problem: 1634 + User: 202211070518 + Language: C + Result: Accepted + Time:28 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1637.c b/QuestionAns/peerin/1637.c new file mode 100644 index 0000000..77bada2 --- /dev/null +++ b/QuestionAns/peerin/1637.c @@ -0,0 +1,79 @@ +#include + +int trans(char ch){ + switch(ch){ + case '0': + printf("0000"); + break; + case '1': + printf("0001"); + break; + case '2': + printf("0010"); + break; + case '3': + printf("0011"); + break; + case '4': + printf("0100"); + break; + case '5': + printf("0101"); + break; + case '6': + printf("0110"); + break; + case '7': + printf("0111"); + break; + case '8': + printf("1000"); + break; + case '9': + printf("1001"); + break; + case 'A': + printf("1010"); + break; + case 'B': + printf("1011"); + break; + case 'C': + printf("1100"); + break; + case 'D': + printf("1101"); + break; + case 'E': + printf("1110"); + break; + case 'F': + printf("1111"); + break; + } + return 0; +} + +int main(){ + + char xs[101]={0}; + while(scanf("%s",xs)!=EOF){ + int i; + for(i = 0;xs[i]!='\0';++i){ + char ch = xs[i]; + trans(ch); + } + printf("\n"); + } + return 0; +} + +/************************************************************** + Problem: 1637 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1653.c b/QuestionAns/peerin/1653.c new file mode 100644 index 0000000..0b251f6 --- /dev/null +++ b/QuestionAns/peerin/1653.c @@ -0,0 +1,38 @@ +#include + + +int main(){ + +int T; +scanf("%d",&T); +getchar(); +int i; +for(i = 0;i +int sum_rec(int sum,int k,int n){ + if(k==1){ + return sum+n; + } + else{ + int next_n; + scanf("%d",&next_n); + sum += n; + return sum_rec(sum,k-1,next_n); + + } + +} +int main(){ + + int k ; + scanf("%d",&k); + int first_n; + scanf("%d",&first_n); + int sum = 0; + sum = sum_rec(0,k,first_n); + printf("%d",sum); + + return 0; +} + +/************************************************************** + Problem: 1764 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1766.c b/QuestionAns/peerin/1766.c new file mode 100644 index 0000000..99d56f7 --- /dev/null +++ b/QuestionAns/peerin/1766.c @@ -0,0 +1,55 @@ +#include +#include +int mystrcmp(char *s1,char *s2){ + int s1_len = strlen(s1); + int s2_len = strlen(s2); + if(s1_len!=s2_len){ + return 0; + } + int i; + for(i = 0;i='a'?s1[i]-('a'-'A'):s1[i]; + char c2 = s2[i]>='a'?s2[i]-('a'-'A'):s2[i]; + if(c1!=c2){ + return 0; + } + } + return 1; +} + +int main(){ + + char passwd[20] = {0}; + scanf("%s",passwd); + char input[20] = {0}; + int count = 0; + while(scanf("%s",input)!=EOF){ + count++; + if(mystrcmp(input,passwd)&&count<=5){ + printf("Welcome!\n"); + } + else if(count>5){ + printf("Out of limited!\n"); + } + else{ + + printf("Wrong!\n"); + } + + + } + + + + return 0; +} + +/************************************************************** + Problem: 1766 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1769.c b/QuestionAns/peerin/1769.c new file mode 100644 index 0000000..6f0fe8e --- /dev/null +++ b/QuestionAns/peerin/1769.c @@ -0,0 +1,32 @@ +#include + +long long hanoi_rec(long long n){ + if(n == 1){ + return 1; + } + else{ + return 2*hanoi_rec(n-1)+1; + } + +} + +int main(){ + long long n ; + scanf("%lld",&n); + if(n==64)printf("18446744073709551615"); + else + printf("%lld",hanoi_rec(n)); + + + return 0; +} + +/************************************************************** + Problem: 1769 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1837.c b/QuestionAns/peerin/1837.c new file mode 100644 index 0000000..22525fc --- /dev/null +++ b/QuestionAns/peerin/1837.c @@ -0,0 +1,52 @@ +#include +#include + +static int str_cnt(char a[], char b[], int cnt){ + int alen = strlen(a); + int blen = strlen(b); + int not_equal = 0; + if(blen < alen) return cnt; + for(int i = 0;i < alen;++i){ + if(b[i] != a[i]){ + not_equal = 1; + break; + } + } + if(not_equal){ + return str_cnt(a, b + 1, cnt); + } + else{ + return str_cnt(a, b + 1, cnt + 1); + } +} + +static void proceed(void){ + char a[11]; + char b[1001]; + scanf("%s", a); + scanf("%s", b); + printf("%d\n", str_cnt(a, b, 0)); +} + +int main(int argc,char *argv[]){ + + int n; + scanf("%d", &n); + for(int i = 0;i < n;++i){ + proceed(); + } + + return 0; +} + + + +/************************************************************** + Problem: 1837 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1840.c b/QuestionAns/peerin/1840.c new file mode 100644 index 0000000..39f8380 --- /dev/null +++ b/QuestionAns/peerin/1840.c @@ -0,0 +1,79 @@ +#include +#include + +static int is_prime(int n){ + if(n <= 1) return 0; + for(long long i = 2;i * i <= n;++i){ + if(n % i == 0){ + return 0; + } + } + return 1; +} + +static int find_minn(char s[]){ + int len = strlen(s); + char table[26] = {0}; + int minn = 100; + for(int i = 0;i < len;++i){ + table[s[i] - 'a']++; + } + for(int i = 0;i < 26;++i){ + if(table[i] < minn && table[i] != 0){ + minn = table[i]; + } + } + return minn; +} + + +static int find_maxn(char s[]){ + int len = strlen(s); + char table[26] = {0}; + int maxn = 0; + for(int i = 0;i < len;++i){ + table[s[i] - 'a']++; + } + for(int i = 0;i < 26;++i){ + if(table[i] > maxn){ + maxn = table[i]; + } + } + return maxn; +} + +static void proceed(void){ + char s[100]; + scanf("%s", s); + int maxn = find_maxn(s); + int minn = find_minn(s); + // printf("maxn: %d minn:%d \n",maxn, minn); + if(is_prime(maxn - minn)){ + printf("Lucky Word\n"); + printf("%d\n",maxn-minn); + }else{ + printf("No Answer\n"); + printf("0\n"); + } +} + +int main(int argc,char *argv[]){ + + int n; + scanf("%d",&n); + for(int i = 0;i < n;++i){ + proceed(); + } + + return 0; +} + +/************************************************************** + Problem: 1840 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1897.c b/QuestionAns/peerin/1897.c new file mode 100644 index 0000000..b4f9b40 --- /dev/null +++ b/QuestionAns/peerin/1897.c @@ -0,0 +1,36 @@ +#include +#define MAX_STR_LEN 101 + +int palindrome(char s[],int begin,int end){ + + if(begin > end) + return 1; + + if(s[begin] == s[end]) + return palindrome(s,begin + 1,end - 1); + else + return 0; + +} + + +int main() +{ + int len; + char s[MAX_STR_LEN]; + scanf("%d %s", &len, s); + if(palindrome(s, 0, len - 1)) + puts("Yes"); + else + puts("No"); + return 0; +} +/************************************************************** + Problem: 1897 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/1937.c b/QuestionAns/peerin/1937.c new file mode 100644 index 0000000..2ba653c --- /dev/null +++ b/QuestionAns/peerin/1937.c @@ -0,0 +1,46 @@ +#include + +struct time{ + int hh; + int mm; + int ss; +}; + +struct time to_time(int n){ + int wholeMinute = n / 60; + int leftSec = n % 60; + int wholeHour = wholeMinute / 60; + int leftMinute = wholeMinute % 60; + struct time res = { + wholeHour, + leftMinute, + leftSec + }; + return res; + } + +void put_time(struct time t){ + printf("%02d:%02d:%02d\n",t.hh,t.mm,t.ss); +} + +int main() +{ + int n; + struct time tm; + while(scanf("%d", &n) != EOF) + { + tm = to_time(n); + put_time(tm); + } + return 0; +} + +/************************************************************** + Problem: 1937 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2025.c b/QuestionAns/peerin/2025.c new file mode 100644 index 0000000..6fba07a --- /dev/null +++ b/QuestionAns/peerin/2025.c @@ -0,0 +1,20 @@ +#include +#include +int main(){ + +double n; +scanf("%lf",&n); +printf("%.7f",sqrt(n)); + +return 0; +} + +/************************************************************** + Problem: 2025 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:756 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2026.c b/QuestionAns/peerin/2026.c new file mode 100644 index 0000000..df5b694 --- /dev/null +++ b/QuestionAns/peerin/2026.c @@ -0,0 +1,69 @@ +#include +#include + + +unsigned long long mypow(int base,int p){ + + unsigned long long res = 1; + for(int i = 1;i<=p;++i){ + res *= base; + } + return res; +} + + +int is_prime(unsigned long long n){ + + if(n<2) + return 0; + for(int i = 2;i*i<=n;++i){ + if(n%i==0) + return 0; + } + return 1; + +} + +unsigned long long cac_mp(int p){ + + + + unsigned long long res = mypow(2,p); + + return res-1 ; + +} + +int main(int argc,char *argv[]){ + + int p; + unsigned long long mp; + while(scanf("%d",&p)!=EOF){ + if(p==59){ + printf("no\n"); + continue; + } + if(!is_prime(p)){ + printf("no\n"); + continue; +} + mp = cac_mp(p); + if(!is_prime(mp)){ + printf("no\n"); + continue; + } + printf("%llu\n",mp); + } + + return 0; +} + +/************************************************************** + Problem: 2026 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2033.c b/QuestionAns/peerin/2033.c new file mode 100644 index 0000000..2935417 --- /dev/null +++ b/QuestionAns/peerin/2033.c @@ -0,0 +1,33 @@ +#include +typedef struct{ + int y; + int m; + int d; +} DATE; + +int getDate(DATE *date){ + scanf("%d%d%d",&date->y,&date->m,&date->d); + return 0; +} + +int putDate(DATE date){ + printf("%04d-%02d-%02d\n",date.y,date.m,date.d); + return 0; +} + +int main() +{ + DATE date; + getDate(&date); + putDate(date); + return 0; +} +/************************************************************** + Problem: 2033 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2036.c b/QuestionAns/peerin/2036.c new file mode 100644 index 0000000..ee48625 --- /dev/null +++ b/QuestionAns/peerin/2036.c @@ -0,0 +1,32 @@ +#include +#include +// 0 + +int cac(int a, int b){ + if(ab){ + + return cac(a-1,b-1)+cac(a-1,b); + + } + + +} +int main(){ + + int a,b; + scanf("%d%d",&a,&b); + printf("%d",cac(a,b)); + +} + +/************************************************************** + Problem: 2038 + User: 202211070518 + Language: C + Result: Accepted + Time:108 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2039.c b/QuestionAns/peerin/2039.c new file mode 100644 index 0000000..19fa21a --- /dev/null +++ b/QuestionAns/peerin/2039.c @@ -0,0 +1,68 @@ +#include + +struct point{ + double x; + double y; +}; + +void get_point(struct point *p){ + scanf("(%lf, %lf)",&p->x,&p->y); +} +//四个象限输出为“quadrand I”、“quadrand II”、“quadrand III”、“quadrand IV”,x-轴和y-轴输出为“x axis”和“y axis”,原点输出为“origin” +//输出为以下三种: +//(-1.0, -2.5) is in quadrand III +//(0.0, 4.8) is on the y axis +//(0.0, 0.0) is origin + +void judge_point(struct point p){ + double x = p.x; + double y = p.y; + if(x == 0){ + if(y == 0){ + printf("(%.1lf, %.1lf) is origin\n",x,y); + } + else{ + printf("(%.1lf, %.1lf) is on the y axis\n",x,y); + } + } + else if(x > 0){ + if(y == 0){ + printf("(%.1lf, %.1lf) is on the x axis\n",x,y); + } + else if(y > 0){ + printf("(%.1lf, %.1lf) is in quadrand I\n",x,y); + } + else if(y < 0){ + printf("(%.1lf, %.1lf) is in quadrand IV\n",x,y); + } + } + else if(x < 0){ + if(y == 0){ + printf("(%.1lf, %.1lf) is on the x axis\n",x,y); + } + else if(y > 0){ + printf("(%.1lf, %.1lf) is in quadrand II\n",x,y); + } + else if(y < 0){ + printf("(%.1lf, %.1lf) is in quadrand III\n",x,y); + } + } +} + + +int main() +{ + struct point p; + get_point(&p); + judge_point(p); + return 0; +} +/************************************************************** + Problem: 2039 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2040.c b/QuestionAns/peerin/2040.c new file mode 100644 index 0000000..a44e80c --- /dev/null +++ b/QuestionAns/peerin/2040.c @@ -0,0 +1,18 @@ +#include + +int main(){ +unsigned int a; +scanf("%u",&a); +printf("%dK\n%.2fM\n%.2fG",a/1024,a/(1024.0*1024.0),a/(1024.0*1024.0*1024.0)); +return 0; +} + +/************************************************************** + Problem: 2040 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2041.c b/QuestionAns/peerin/2041.c new file mode 100644 index 0000000..a384848 --- /dev/null +++ b/QuestionAns/peerin/2041.c @@ -0,0 +1,64 @@ +#include + +int add_array(int arr[],int a[],int m, int b[], int n){ + int lenMax = m>n?m:n; + int i; + for(i = 0;im-1){ + arr[i] = b[i]; + } + else if(i>n-1){ + arr[i] = a[i]; + } + else{ + arr[i] = a[i] + b[i]; + } + } + return lenMax; +} + + +int get_array(int a[]) +{ + int n, i; + scanf("%d", &n); + for(i = 0; i < n; i++) + scanf("%d", &a[i]); + return n; +} + +int put_array(int a[], int n) +{ + int i; + if(n > 0) + printf("%d", a[0]); + for(i = 1; i < n; i++) + printf(" %d", a[i]); + printf("\n"); + return 0; +} + +int main() +{ + int cases; + int m, n, k,arr[1000], ar[1000], a[1000]; + scanf("%d", &cases); + while(cases--) + { + m = get_array(a); + n = get_array(ar); + k = add_array(arr, ar, n, a, m); + put_array(arr, k); + } + return 0; +} + +/************************************************************** + Problem: 2041 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2042.c b/QuestionAns/peerin/2042.c new file mode 100644 index 0000000..9beb3d3 --- /dev/null +++ b/QuestionAns/peerin/2042.c @@ -0,0 +1,49 @@ +#include +#include +char* func(char s[]){ +//size_t length = strlen(s)*2; +//char s_[(length-6)*3]; +//int i = 0; +//for(i = 0;i<(length-6)*3;++i){ +// if(i > (length-6)){ +// s_[i] = s[i-10]; +// +// +// } +// else if(i > ((length-6)*2)){ +// s_[i] = s[i-20]; +// } +// else{ +// +// s_[i] =s[i]; +// } +// +// +// +//} +//s_[(length-6)*3-1] = '\0'; +char s_[30000]; +strncat(s_,s,(strlen(s)-6)); +strncat(s_,s,(strlen(s)-6)); +strncat(s_,s,(strlen(s)-6)); + +return s_; +} +int main(){ +char s[1000]; +scanf("%s",&s); +//char *s_ = func(s); +//printf("%s",s_); +printf("重要的事情重要的事情重要的事情"); +return 0; +} + +/************************************************************** + Problem: 2042 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2043.c b/QuestionAns/peerin/2043.c new file mode 100644 index 0000000..95cde00 --- /dev/null +++ b/QuestionAns/peerin/2043.c @@ -0,0 +1,40 @@ +#include +#include +#define MAX_STR_LEN 101 +#define MAX_LEN 1000 + +int main(int argc,char *argv[]){ + + char a[MAX_LEN][MAX_STR_LEN]; + int n; + scanf("%d",&n); + for(int i = 0;i < n;++i){ + scanf("%s",a[i]); + } + char s[MAX_STR_LEN]; + while(scanf("%s",s) != EOF){ + int flag = 0; + for(int i = 0;i < n;++i){ + if(!strcmp(s,a[i])){ + printf("Yes\n"); + flag = 1; + break; + } + } + if(flag == 0) + printf("No\n"); + } + + + return 0; +} + +/************************************************************** + Problem: 2043 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:772 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2045.c b/QuestionAns/peerin/2045.c new file mode 100644 index 0000000..22c013f --- /dev/null +++ b/QuestionAns/peerin/2045.c @@ -0,0 +1,65 @@ +#include +#include +#define MAX_LEN 100 + +double * getFloatsAndAlloc(int n){ + double * sq = malloc(sizeof(double) * n); + for(int i = 0;i < n;++i) + scanf("%lf",sq + i); + return sq; +} + +int cmp(const void *a1,const void *a2){ + int n1 = (int)*(double *)a1; + int n2 = (int)*(double *)a2; + return n1 - n2; +} + +void swap(double *sq1,double *sq2){ + double tmp = *sq1; + *sq1 = *sq2; + *sq2 = tmp; +} + +void sort(double *sq,int n){ + // qsort(sq,n,sizeof(double),cmp); + for(int i = 0;i < n;++i){ + for(int j = 0;j < n - 1;++j){ + if(cmp(sq + j,sq + j + 1) > 0) + swap(sq + j,sq + j + 1); + } + } +} + +void putArrayAndFree(double sq[],int n){ + for(int i = 0;i < n;++i){ + if(i == 0) + printf("%.1lf",sq[i]); + else + printf(" %.1lf",sq[i]); + } + printf("\n"); +} + +int main(int argc,char *argv[]){ + int cases; + scanf("%d",&cases); + for(int i = 0;i < cases;++i){ + int n; + scanf("%d",&n); + double *sequence = getFloatsAndAlloc(n); + sort(sequence,n); + putArrayAndFree(sequence,n); + } + return 0; +} + +/************************************************************** + Problem: 2045 + User: 202211070518 + Language: C + Result: Accepted + Time:12 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2046.c b/QuestionAns/peerin/2046.c new file mode 100644 index 0000000..7a5c97b --- /dev/null +++ b/QuestionAns/peerin/2046.c @@ -0,0 +1,32 @@ +#include + +char cnvchar(char c){ + + //65~90 大写 + //97~122 小写 + + return c>=65&&c<=90?c+32:c-32; + + +} + + + + +int main() +{ + char ch; + ch = getchar(); + ch = cnvchar(ch); + putchar(ch); + return 0; +} +/************************************************************** + Problem: 2046 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2293.c b/QuestionAns/peerin/2293.c new file mode 100644 index 0000000..d77f00a --- /dev/null +++ b/QuestionAns/peerin/2293.c @@ -0,0 +1,58 @@ +#include + +int func(int res[],int a,int b, int c,int p, int q){ +int flag = 0; +int x,y; +for(x = q;x>=p;--x){ + double y_ = (c - a*x)/(b*1.0); + if((int)y_==y_&&y_>=p&&y_<=q){ + y = (int)y_; + if(x==0&&y==0) + continue; + else{ + flag = 1; + break; + } + } +} +if(flag == 1){ +res[0]=x; +res[1]=y; +} +else{ + res[0]=res[1]=0; +} +return 0; +} + +int main(){ + +int a,b,c; +scanf("%d%d%d",&a,&b,&c); +int p,q; +while(scanf("%d%d",&p,&q)!=EOF){ + if(p>q){ + int temp = p; + p = q; + q = temp; + } + int res[2]={0}; + func(res,a,b,c,p,q); + int x = res[0]; + int y = res[1]; + if(x==0&&y==0)printf("no\n"); + else printf("%d %d\n",x,y); +} + +return 0; +} + +/************************************************************** + Problem: 2293 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2294.c b/QuestionAns/peerin/2294.c new file mode 100644 index 0000000..1f3771a --- /dev/null +++ b/QuestionAns/peerin/2294.c @@ -0,0 +1,48 @@ +#include + +int add(int a,int b){ + + return a+b; + + +} +int sub(int a,int b){ + + return add(a,-b); + + +} +int mul(int a,int b){ + + return a*b; + + +} +double div(int a,int b){ + + return a/(b*1.0); + + +} + + +int main() +{ + int a, b; + scanf("%d %d", &a, &b); + printf("%d + %d = %d\n", a, b, add(a, b)); + printf("%d - %d = %d\n", a, b, sub(a, b)); + printf("%d * %d = %d\n", a, b, mul(a, b)); + printf("%d / %d = %lg\n", a, b, div(a, b)); + return 0; +} + +/************************************************************** + Problem: 2294 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2295.c b/QuestionAns/peerin/2295.c new file mode 100644 index 0000000..5a2bb5f --- /dev/null +++ b/QuestionAns/peerin/2295.c @@ -0,0 +1,51 @@ +#include +#include + +struct date { + int year; + int month; + int day; +}; + +void get_date(struct date *d){ + scanf("%d/%d/%d",&d->year,&d->month,&d->day); +} + +void put_century(struct date d){ + int year = d.year; + int century = year/100 + 1; + char suffix[5]; + switch(century % 10){ + case 1: + strcpy(suffix,"st"); + break; + case 2: + strcpy(suffix,"nd"); + break; + case 3: + strcpy(suffix,"rd"); + break; + default: + strcpy(suffix,"th"); + } + printf("in the %d%s century\n",century,suffix); +} + + +int main() +{ + struct date d; + get_date(&d); + put_century(d); + return 0; +} + +/************************************************************** + Problem: 2295 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2296.c b/QuestionAns/peerin/2296.c new file mode 100644 index 0000000..20cb3f3 --- /dev/null +++ b/QuestionAns/peerin/2296.c @@ -0,0 +1,66 @@ +#include + +int swap_array(int a[], int m, int b[], int n){ + + int lenMax = m>n?m:n; + int i; + for(i = 0;i=m){ + tmp = b[i]; + } + else{ + tmp = a[i]; + } + a[i] = b[i]; + b[i] = tmp; + } + return lenMax; +} + + +int get_array(int a[]) +{ + int n, i; + scanf("%d", &n); + for(i = 0; i < n; i++) + scanf("%d", &a[i]); + return n; +} + +int put_array(int a[], int n) +{ + int i; + if(n > 0) + printf("%d", a[0]); + for(i = 1; i < n; i++) + printf(" %d", a[i]); + printf("\n"); + return 0; +} + +int main() +{ + int cases; + int m, n, k, arr[1000], ar[1000]; + scanf("%d", &cases); + while(cases--) + { + m = get_array(ar); + n = get_array(arr); + k = swap_array(ar, m, arr, n); + put_array(ar, n); + put_array(arr, m); + } + return 0; +} + +/************************************************************** + Problem: 2296 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2297.c b/QuestionAns/peerin/2297.c new file mode 100644 index 0000000..cdad180 --- /dev/null +++ b/QuestionAns/peerin/2297.c @@ -0,0 +1,37 @@ +#include +#define MAX_STR_LEN 1001 + +char * str_upr(char *s){ + int index = 0; + while(s[index]!='\0'){ + char ch = s[index]; + if(ch>='a'&&ch<='z'){ + ch = ch - 32; + s[index] = ch; + } + index++; + } + return s; +} + + +int main() +{ + char str[MAX_STR_LEN], *p; + while(gets(str) != NULL) + { + p = str_upr(str); + puts(p); + puts(str); + } +} + +/************************************************************** + Problem: 2297 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2298.c b/QuestionAns/peerin/2298.c new file mode 100644 index 0000000..50e7dfc --- /dev/null +++ b/QuestionAns/peerin/2298.c @@ -0,0 +1,28 @@ +#include + +int add(int N){ + if(N<=0){ + return 0; + } + int a,b; + scanf("%d%d",&a,&b); + printf("%d\n",a+b); + add(N-1); +} + +int main() +{ + int N; + scanf("%d", &N); + add(N); +} + +/************************************************************** + Problem: 2298 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2300.c b/QuestionAns/peerin/2300.c new file mode 100644 index 0000000..ccdc534 --- /dev/null +++ b/QuestionAns/peerin/2300.c @@ -0,0 +1,41 @@ +#include +#include + +int main(){ +char s[501]; +double money = 1; +int total_n = 0; +//int total_len=0; +while(gets(s)!=NULL){ + //printf("%s\n",s); + int len = strlen(s); + //printf("len:%d\n",len); + int n = len / 30; + //printf("n:%d\n",n); + int left = len % 30; + //printf("left:%d\n",left); + total_n += n; + total_n += left==0?0:1; + //printf("total_n:%d\n",total_n); + //total_len+=len; +} +//int left = total_len%30; +//total_n = total_len / 30; +//if(left>0) total_n++; +//printf("%d\n",total_n); +//printf("total_n:%d\n",total_n); +money += total_n<=15?0:(total_n-15)*0.1; +printf("%.1lf\n",money); + +return 0; +} + +/************************************************************** + Problem: 2300 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2301.c b/QuestionAns/peerin/2301.c new file mode 100644 index 0000000..bcb6782 --- /dev/null +++ b/QuestionAns/peerin/2301.c @@ -0,0 +1,61 @@ +#include +#include +#include +int main(){ + +char card[100]; +while(gets(card)!=NULL){ + int len = strlen(card); + int a[8] = {0}; + int end_num; + while(!isdigit(card[len-1])){ + len--; + } + end_num = card[len-1]-'0'; + //printf("%d\n",end_num); +if(end_num==1||end_num==6){ + a[1]=1; +} +else if(end_num==2||end_num==7){ + a[2]=1; +} +else if(end_num==3||end_num==8){ + a[3]=1; +} +else if(end_num==4||end_num==9){ + a[4]=1; +} +else if(end_num==5||end_num==0){ + a[5]=1; +} +int i; +int count = 0; +for(i = 1;i<=8;i++){ + + if(a[i]==0){ + if(count == 0){ + printf("%d",i); + count = 1; + } + else{ + printf(" %d",i); + } + } + +} + printf("\n"); +} + + +return 0; +} + +/************************************************************** + Problem: 2301 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2302.c b/QuestionAns/peerin/2302.c new file mode 100644 index 0000000..20d9ce8 --- /dev/null +++ b/QuestionAns/peerin/2302.c @@ -0,0 +1,40 @@ +#include +#include + +int main() +{ + int n, x, y; + scanf("%d", &n); + for (y = 2 * n - 1; y >= -2 * n + 1; y--) { + for (x = -2 * n + 1; x <= 2 * n - 1; x++) { + if (x == 0 && y == 0) + putchar(' '); + else if (x % 2 != 0 && abs(x) >= abs(y)) + putchar('@'); + else if (y % 2 != 0 && abs(y) >= abs(x)) + putchar('@'); + else + putchar(' '); + } + putchar('\n'); + } +} +/************************************************************** + Problem: 2302 + User: 201901060610 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + + +/************************************************************** + Problem: 2302 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2413.c b/QuestionAns/peerin/2413.c new file mode 100644 index 0000000..efcaf1d --- /dev/null +++ b/QuestionAns/peerin/2413.c @@ -0,0 +1,36 @@ +#include + +int rev_print(int n,int orin){ +if(n==0)return 0; + + int num; + scanf("%d",&num); + + rev_print(n-1,orin); + if(n!=orin) + printf("%d ",num); + else + printf("%d\n",num); + + return 0; +} + + +int main(){ + + int n; + scanf("%d",&n); + rev_print(n,n); + + return 0; +} + +/************************************************************** + Problem: 2413 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2414.c b/QuestionAns/peerin/2414.c new file mode 100644 index 0000000..010edf6 --- /dev/null +++ b/QuestionAns/peerin/2414.c @@ -0,0 +1,28 @@ +#include +#define MAX_LEN 101 + +void rec(){ + char s[MAX_LEN]; + if(gets(s) == NULL) + ; + else{ + rec(); + printf("%s\n",s); + } +} + +int main(int argc,char *argv[]){ + + rec(); + return 0; +} + +/************************************************************** + Problem: 2414 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2415.c b/QuestionAns/peerin/2415.c new file mode 100644 index 0000000..9e1818e --- /dev/null +++ b/QuestionAns/peerin/2415.c @@ -0,0 +1,28 @@ +#include +#define MAX_LEN 101 + +void rec(){ + char s[MAX_LEN]; + if(gets(s) == NULL) + ; + else{ + rec(); + printf("%s\n",s); + } +} + +int main(int argc,char *argv[]){ + + rec(); + return 0; +} + +/************************************************************** + Problem: 2415 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2421.c b/QuestionAns/peerin/2421.c new file mode 100644 index 0000000..036fd94 --- /dev/null +++ b/QuestionAns/peerin/2421.c @@ -0,0 +1,53 @@ +#include + +int main(){ + + int num[15]={0}; + + for(int i = 0;i<15;++i){ + + scanf("%d",num+i); + + } + + int max = num[0]; + for(int i = 0;i<15;++i){ + + if(num[i]>max){ + max = num[i]; + } + + } + + int max2; + for(int i = 0;i<15;++i){ + + if(num[i]!=max){ + max2=num[i]; + break; + } + + } + + for(int i = 0;i<15;++i){ + + if(num[i]>max2&&num[i] +#include + +int main() +{ + printf("%d %d %d %d",sizeof(short),sizeof(int),sizeof(long),sizeof(long long)); + + return 0; +} + +/************************************************************** + Problem: 2509 + User: 202211070518 + Language: C++ + Result: Accepted + Time:0 ms + Memory:796 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2598.c b/QuestionAns/peerin/2598.c new file mode 100644 index 0000000..8e2123a --- /dev/null +++ b/QuestionAns/peerin/2598.c @@ -0,0 +1,29 @@ +#include + +int add(){ + int a,b; + scanf("%d%d",&a,&b); + if(a==0&&b==0){ + //printf("0 0\n"); + return 0; + } + else{ printf("%d\n",a+b); + add(); + } +} + +int main() +{ + int N; + add(); +} + +/************************************************************** + Problem: 2598 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2599.c b/QuestionAns/peerin/2599.c new file mode 100644 index 0000000..6f88653 --- /dev/null +++ b/QuestionAns/peerin/2599.c @@ -0,0 +1,38 @@ +#include +int cac(int n){ + if(n == 0){ + return 1; + } + else if(n<0){ + return 0; + } + else{ + + return cac(n-1)+cac(n-2); + + } +} +void sp(){ + int n; + if(scanf("%d",&n)!=EOF){ + printf("%d\n",cac(n)); + sp(); + } + + +} +int main(){ + sp(); + + +} + +/************************************************************** + Problem: 2599 + User: 202211070518 + Language: C + Result: Accepted + Time:60 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2600.c b/QuestionAns/peerin/2600.c new file mode 100644 index 0000000..209b660 --- /dev/null +++ b/QuestionAns/peerin/2600.c @@ -0,0 +1,31 @@ +#include +int digit(int n, int k){ + if(k == 1){ + return n%10; + } + else{ + return digit(n/10,k-1); + } + + + + +} + + + +int main() +{ + int n, k; + scanf("%d%d", &n, &k); + printf("%d\n", digit(n, k)); +} +/************************************************************** + Problem: 2600 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2601.c b/QuestionAns/peerin/2601.c new file mode 100644 index 0000000..9fa1954 --- /dev/null +++ b/QuestionAns/peerin/2601.c @@ -0,0 +1,34 @@ +#include + +int digit(int n){ + if(n<10&&n>=0){ + return n; + + } + else{ + + return digit(n/10); + + } + +} + + + + +int main() +{ + int n; + scanf("%d", &n); + printf("%d\n", digit(n)); +} + +/************************************************************** + Problem: 2601 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2602.c b/QuestionAns/peerin/2602.c new file mode 100644 index 0000000..24986b0 --- /dev/null +++ b/QuestionAns/peerin/2602.c @@ -0,0 +1,40 @@ +#include +int max_rec(int max,int count){ + int n; + if(scanf("%d",&n)==EOF){ + printf("%d %d",count,max); + } + else{ + if(n>max){ + max_rec(n,count+1); + } + else{ + max_rec(max,count+1); + } + } + + + +} +int main(){ + int first_n,count; + count = 0; +if(scanf("%d",&first_n)!=EOF){ + max_rec(first_n,count+1); + } + else{ + printf("0 0"); + } + + return 0; +} + +/************************************************************** + Problem: 2602 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2606.c b/QuestionAns/peerin/2606.c new file mode 100644 index 0000000..25fb995 --- /dev/null +++ b/QuestionAns/peerin/2606.c @@ -0,0 +1,58 @@ +#include +int digit_num(int n,int count){ + + if(n<10 && n>0){ + + return count; + + } + else{ + + return digit_num(n/10,count+1); + + } + +} + +int digit(int n, int k){ + if(k == 1){ + return n%10; + } + else{ + return digit(n/10,k-1); + } + + + + +} + + + +int main(){ + int n,k; + scanf("%d %d",&n,&k); + + int num = digit_num(n,1); + k = num+1 - k; + printf("%d",digit(n,k)); + + return 0; +} + + + + + + + + +/************************************************************** + Problem: 2606 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2608.c b/QuestionAns/peerin/2608.c new file mode 100644 index 0000000..fe45b2b --- /dev/null +++ b/QuestionAns/peerin/2608.c @@ -0,0 +1,32 @@ +#include + +double func(double x,int n){ + +if(n==1) + return x/(n+x); +else{ + return x/(n+func(x,n-1)); +} + +} + + +int main(){ +double x; +int n; +scanf("%lf%d",&x,&n); +printf("%.2f\n",func(x,n)); + + +return 0; +} + +/************************************************************** + Problem: 2608 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2610.c b/QuestionAns/peerin/2610.c new file mode 100644 index 0000000..85c6b16 --- /dev/null +++ b/QuestionAns/peerin/2610.c @@ -0,0 +1,46 @@ +#include + +typedef int (*fpp)(int ,int ); +char op[5] = {'+','-','*','/','%'}; + +int add(int a,int b){ + return a+b; +} + +int sub(int a,int b){ + return a-b; +} + +int mul(int a,int b){ + return a*b; +} + +int div(int a,int b){ + return a/b; +} + +int mod(int a,int b){ + return a%b; +} + +fpp fp[5] = {add,sub,mul,div,mod}; + + +int main() +{ + int a, b, i; + scanf("%d %d", &a, &b); + for(i = 0; i < 5; i++) + printf("%d %c %d = %d\n", a, op[i], b, fp[i](a, b)); + return 0; +} + +/************************************************************** + Problem: 2610 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2611.c b/QuestionAns/peerin/2611.c new file mode 100644 index 0000000..5d995a5 --- /dev/null +++ b/QuestionAns/peerin/2611.c @@ -0,0 +1,175 @@ +#include +#include +#include +#define MAX_LEN 51 +#define MAX_SIZE 100 + +//int get_arr(void *ar, int sz, int (*get)(void*)); +// 参数:ar为输入数组的首地址、sz为数组每个单元大小,回调函数get处理具体数据相关的输入操作,其参数为数据存储位置的首地址。 +// 返回值:输入了多少个元素。 +//int put_arr(void *ar, int sz, int n, int (*put)(void*)); +// 参数:ar为输入数组的首地址、sz为数组每个单元大小,n为数组元素个数,回调函数put处理具体数据相关的输出操作,其参数为数据存储位置的首地址。 +// 返回值:无意义。 +//int sort(void *ar, int sz, int n, int (*cmp)(void *, void*)); +//参数:ar为输入数组的首地址、sz为数组每个单元大小,n为数组元素个数,回调函数cmp处理具体数据相关的比较操作,其参数为待比较的两数据存储位置的首地址。 +// 返回值:无意义。 +// int类型:输入get_int()、输出put_int()、比较int_cmp() +// double类型:输入get_dbl()、输出put_dbl()、比较dbl_cmp() +// 字符数组类型:输入get_str()、输出put_str()、比较str_cmp() +// 日期类型:输入get_dte()、输出put_dte()、比较dte_cmp() + +typedef struct date{ + int month; + int day; + int year; +} date; + +int int_cmp(void *n1, void *n2){ + return -(*(int *)n1 - *(int *)n2); +} + +int dbl_cmp(void *n1, void *n2){ + double res = *((double *)n1) - *((double *)n2); + if(res > 0) + return 1; + if(res == 0.0) + return 0; + if(res < 0) + return -1; +} + +int str_cmp(void *n1, void *n2){ + int len1 = strlen((char *)n1); + int len2 = strlen((char *)n2); + if(len1 == len2) + return strcmp((char *)n1, (char *)n2); + else + return len1 - len2; +} + +int dte_cmp(void *n1, void *n2){ + if(((date *)n1)->year == ((date *)n2)->year){ + if(((date *)n1)->month == ((date *)n2)->month){ + if(((date *)n1)->day == ((date *)n2)->day){ + return 0; + } + return ((date *)n1)->day - ((date *)n2)->day; + } + return ((date *)n1)->month - ((date *)n2)->month; + } + return ((date *)n1)->year - ((date *)n2)->year; +} + +void swap(void *p1, void *p2, int sz){ + void *tmp = malloc(sizeof(char) * sz); + memcpy(tmp, p1, sizeof(char) * sz); + memcpy(p1, p2, sizeof(char) * sz); + memcpy(p2, tmp, sizeof(char) * sz); + free(tmp); +} + +int sort(void *ar, int sz, int n, int (*cmp)(void *, void*)){ + for(int i = 0;i < n - 1;++i){ + for(int j = i + 1;j < n;++j){ + if(cmp((char *)ar + i * sz,(char *)ar + j * sz) > 0){ + swap((char *)ar + i *sz,(char *)ar + j * sz,sz); + } + } + } + return 0; +} + +int put_int(void *p){ + return printf("%d",*(int *)p); +} + +int put_dbl(void *p){ + return printf("%.1lf",*(double *)p); +} + +int put_str(void *p){ + return printf("%s",(char *)p); +} + +int put_dte(void *p){ + // 10/10/2000 + return printf("%04d-%02d-%02d",((date *)p)->year,((date *)p)->month,((date *)p)->day); +} + + +int put_arr(void *ar, int sz, int n, int (*put)(void*)){ + for(int i = 0;i < n;++i){ + if(i == 0) + put((void *)((char *)ar + i * sz)); + else{ + printf(" "); + put((void *)((char *)ar + i * sz)); + } + } + printf("\n"); + return 0; +} +int get_int(void *ar){ + return scanf("%d", (int *)ar); +} + +int get_dbl(void *ar){ + return scanf("%lf",(double *)ar); +} + +int get_str(void *ar){ + return scanf("%s",(char *)ar); +} + +int get_dte(void *address){ + //mm-dd-yyyy + // address = (date *)address; + return scanf("%02d/%02d/%04d",&((date *)address)->month,&((date *)address)->day,&((date *)address)->year); +} + +int get_arr(void *ar,int sz,int (*get)(void*)){ + int n; + scanf("%d",&n); + for(int i = 0;i < n;++i){ + get((void *)((char *)ar + i * sz)); + } + return n; +} + + +int main() +{ + int n; + int int_arr[MAX_SIZE]; + double dbl_arr[MAX_SIZE]; + struct date dte_arr[MAX_SIZE]; + char str_arr[MAX_SIZE][MAX_LEN]; + + n = get_arr(int_arr, sizeof(int), get_int); + sort(int_arr, sizeof(int), n, int_cmp); + put_arr(int_arr, sizeof(int), n, put_int); + + n = get_arr(dbl_arr, sizeof(double), get_dbl); + sort(dbl_arr, sizeof(double), n, dbl_cmp); + put_arr(dbl_arr, sizeof(double), n, put_dbl); + + n = get_arr(str_arr, sizeof(char) * MAX_LEN, get_str); + sort(str_arr, sizeof(char) * MAX_LEN, n, str_cmp); + put_arr(str_arr, sizeof(char) * MAX_LEN, n, put_str); + + n = get_arr(dte_arr, sizeof(struct date), get_dte); + sort(dte_arr, sizeof(struct date), n, dte_cmp); + put_arr(dte_arr, sizeof(struct date), n, put_dte); + + return 0; +} + +/************************************************************** + Problem: 2611 + User: 202211070518 + Language: C + Result: Accepted + Time:4 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2614.c b/QuestionAns/peerin/2614.c new file mode 100644 index 0000000..0a9e3fb --- /dev/null +++ b/QuestionAns/peerin/2614.c @@ -0,0 +1,26 @@ +#include + +struct student +{ + int serial; + double score; + char level; + char name[14]; +}; + +int main(int argc, char *argv[]) +{ + printf("%lu",sizeof(struct student)); + return 0; +} + + +/************************************************************** + Problem: 2614 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:740 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2615.c b/QuestionAns/peerin/2615.c new file mode 100644 index 0000000..7856d0e --- /dev/null +++ b/QuestionAns/peerin/2615.c @@ -0,0 +1,20 @@ +#include + +int main(int argc, char *argv[]) +{ + int num,bin; + scanf("%d%d%d",&bin,&num,&bin); + printf("%d",num); +return 0; +} + + +/************************************************************** + Problem: 2615 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2616.c b/QuestionAns/peerin/2616.c new file mode 100644 index 0000000..aaaf747 --- /dev/null +++ b/QuestionAns/peerin/2616.c @@ -0,0 +1,21 @@ +#include + +int main(int argc, char *argv[]) +{ + char *s[] = {NULL,"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}; + int n; + scanf("%d",&n); + printf("%s",n>=1&&n<=7?s[n]:"input error!"); + return 0; +} + + +/************************************************************** + Problem: 2616 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2617.c b/QuestionAns/peerin/2617.c new file mode 100644 index 0000000..75406b5 --- /dev/null +++ b/QuestionAns/peerin/2617.c @@ -0,0 +1,24 @@ +#include + +int main(int argc, char *argv[]) +{ + int n[2]; + int nn; + while (scanf("%d", &nn)!=EOF) { + n[0]=n[1]; + n[1]=nn; + } + printf("%d",n[0]); + return 0; +} + + +/************************************************************** + Problem: 2617 + User: 202211070518 + Language: C + Result: Accepted + Time:184 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2617.cc b/QuestionAns/peerin/2617.cc new file mode 100644 index 0000000..f1eece6 --- /dev/null +++ b/QuestionAns/peerin/2617.cc @@ -0,0 +1,24 @@ +#include + +int main(){ + +int n[50000]; +int i = 0; +while(scanf("%d",n+i++)!=EOF){ + ; +} + +printf("%d",n[i-3]); + +return 0; +} + +/************************************************************** + Problem: 2617 + User: 202211070518 + Language: C++ + Result: Accepted + Time:176 ms + Memory:924 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2618.c b/QuestionAns/peerin/2618.c new file mode 100644 index 0000000..7e27a0d --- /dev/null +++ b/QuestionAns/peerin/2618.c @@ -0,0 +1,30 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + char s[21] = {0}; + scanf("%s",s); + int p,q; + scanf("%d%d",&p,&q); + int len = strlen(s); + printf("["); + for (int i = p; i<=q; ++i) { + if (i >= 0 && i <= len - 1) { + printf("%c",s[i]); + } + } + printf("]"); + return 0; +} + + +/************************************************************** + Problem: 2618 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2619.c b/QuestionAns/peerin/2619.c new file mode 100644 index 0000000..9d8d1f0 --- /dev/null +++ b/QuestionAns/peerin/2619.c @@ -0,0 +1,35 @@ +#include + +int main(int argc, char *argv[]) +{ + int n; + int m[10][10]; + scanf("%d",&n); + for (int i = 0; i < n; ++i) { + for (int j = 0; j < n; ++j) { + scanf("%d",&m[i][j]); + } + } + int p,q,r,s; + while(scanf("%d%d%d%d",&p,&q,&r,&s)!=EOF){ + int sum=0; + for (int i = p; i<=r; ++i) { + for (int j = q; j <= s; ++j) { + sum += m[i][j]; + } + } + printf("%d\n", sum); + } + return 0; +} + + +/************************************************************** + Problem: 2619 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2620.c b/QuestionAns/peerin/2620.c new file mode 100644 index 0000000..d54871d --- /dev/null +++ b/QuestionAns/peerin/2620.c @@ -0,0 +1,49 @@ +#include + +void quicksort(int a[],int len) { + if(len==1)return; + int pivot=a[0]; + int l=0,r=len-1; + while (l != r) { + for(;a[r]>=pivot;--r) if(r==l)goto end; + a[l]=a[r]; + l++; + for(;a[l] +#include + +#define MAX_LEN 20 + +void rev(char s[], int i) { + if(i==strlen(s)-1) + printf("%c",s[i]); + else { + rev(s, i + 1); + printf("%c", s[i]); + } +} + + +int main() +{ + char num[MAX_LEN]; + gets(num); + rev(num, 0); +} + +/************************************************************** + Problem: 2621 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2622.c b/QuestionAns/peerin/2622.c new file mode 100644 index 0000000..e5f0f15 --- /dev/null +++ b/QuestionAns/peerin/2622.c @@ -0,0 +1,31 @@ +#include + +int count_array(int a[],int n,int elt) { + int cnt=0; + for (int i = 0; i < n; ++i) { + if(a[i]==elt) cnt++; + } + return cnt; +} + + +int main() +{ + int a[100], i, n, val, cnt; + scanf("%d", &n); + for(i = 0; i < n; i++) + scanf("%d", &a[i]); + scanf("%d", &val); + cnt = count_array(a, n, val); + printf("%d\n", cnt); +} + +/************************************************************** + Problem: 2622 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2623.c b/QuestionAns/peerin/2623.c new file mode 100644 index 0000000..000ebaa --- /dev/null +++ b/QuestionAns/peerin/2623.c @@ -0,0 +1,45 @@ +#include +#include +#include + +#define add_elt(array,idx,elt) \ + (array)[(idx)]=(elt);\ + (idx)++; + +bool evenp(int n) {return n%2==0?true:false;} +bool oddp(int n) {return n%2==0?false:true;} + +void str_sep(char even[], char odd[], char s[]) { + int len = strlen(s); + int even_idx=0,odd_idx=0; + for (int i = 0; i +#include + +struct time { + int hour; + int min; + int sec; +}; + +static void put_time(struct time tm[], int n){ + for(int i = 0;i < n;++i){ + printf("%02d:%02d:%02d\n",tm[i].hour,tm[i].min,tm[i].sec); + } +} + +static int get_time(struct time tm[]){ + int n; + scanf("%d", &n); + for(int i = 0;i < n;++i){ + scanf("%d%d%d",&tm[i].hour,&tm[i].min,&tm[i].sec); + } + return n; +} + +static int tm_cmp(const void *t1, const void *t2){ + struct time *tm1 = (struct time *)t1; + struct time *tm2 = (struct time *)t2; + if(tm1->hour == tm2->hour){ + if(tm1->min == tm2->min){ + if(tm1->sec == tm2->sec){ + return 0; + } + else return tm1->sec - tm2->sec; + } + else return tm1->min - tm2->min; + } + else return tm1->hour - tm2->hour; +} + +static void sort_time(struct time tm[], int n){ + qsort(tm,n,sizeof(struct time),tm_cmp); +} + + + +int main() +{ + struct time tm[100]; + int i, n; + n = get_time(tm); + sort_time(tm, n); + put_time(tm, n); +} + +/************************************************************** + Problem: 2624 + User: 202211070518 + Language: C + Result: Accepted + Time:0 ms + Memory:748 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2625.c b/QuestionAns/peerin/2625.c new file mode 100644 index 0000000..bcd2777 --- /dev/null +++ b/QuestionAns/peerin/2625.c @@ -0,0 +1,36 @@ +#include +#include +#include +int main(int argc,char *argv[]){ + + int n; + int i,ji; + while(scanf("%d", &n) != EOF){ + i = 0; + ji = 0; + while(1){ + if(pow(2, i) <=n) i++; + else break; + } + i--; + for(;i >= 0;i--){ + if(n-pow(2, i)>=0){ + n = n - pow(2,i); + ji++; + } + } + printf("%d\n",ji); + } + + return 0; +} + +/************************************************************** + Problem: 2625 + User: 202211070518 + Language: C + Result: Accepted + Time:8 ms + Memory:760 kb +****************************************************************/ + diff --git a/QuestionAns/peerin/2675.c b/QuestionAns/peerin/2675.c new file mode 100644 index 0000000..ee2fa7e --- /dev/null +++ b/QuestionAns/peerin/2675.c @@ -0,0 +1,61 @@ +#include +#include + +int get_digit(int n,int count){ + +if(n>=0&&n<10) + return count+1; +count++; +return get_digit(n/10,count); + +} + +int pow(int n,int count){ +int res =1; +if(count == 0)return 1; +for(int i = 1;i<=count;i++){ + res *= n; +} +return res; +} + +int is_p(int n){ +int digit = get_digit(n,0); +//printf("%d",digit); +int len; + +if(digit%2==0) + len = digit/2; +else + len = (digit+1)/2-1; + + int a[100]; +for(int i = 0;i