CT27987

Potter and the Shimmering weights

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Before the gates of the steppe camp of Horselord Plains close for winter, Potter must finish the weights ledger - one figure at a time. Task: Print the k-th smallest element (1-based; duplicates count separately). Input format: First line: n and k. Second line: n integers. Output format: Print the k-th smallest value. Constraints: 1 <= k <= n <= 407; 0 <= a[i] <= 1000.

Example 1:

Input: 157 35 808 194 427 27 219 802 347 151 89 166 762 413 645 424 697 766 352 186 478 512 417 527 263 296 386 643 909 395 787 774 701 525 254 378 910 802 412 67 339 6 925 810 491 515 54 304 540 80 649 818 778 535 856 386 372 466 727 977 710 753 885 871 768 807 864 723 255 634 424 937 644 751 544 960 987 723 847 648 874 653 224 436 662 406 556 494 397 920 972 423 310 696 722 850 71 718 804 783 431 41 797 204 822 760 367 826 80 668 316 994 490 680 315 424 362 815 78 731 225 17 350 458 401 848 330 476 659 421 146 409 259 271 846 502 252 285 55 244 172 756 390 193 132 715 927 504 294 360 63 859 218 94 734 71 715 661 776
Output: 271

Example 2:

Input: 120 112 274 756 766 359 904 385 809 304 41 82 63 381 859 180 331 977 225 166 347 498 874 100 806 128 197 183 243 189 44 982 633 599 374 601 565 868 601 720 991 131 448 124 605 962 499 153 767 462 473 157 835 597 707 394 794 912 650 641 391 991 7 100 559 451 491 882 915 552 191 829 125 580 867 105 294 65 410 304 240 79 17 236 286 222 383 365 371 353 850 27 717 723 945 897 777 699 898 991 793 170 123 539 693 489 8 565 801 414 686 355 845 826 505 263 966 345 675 217 328 175
Output: 915

Example 3:

Input: 209 192 526 216 743 974 716 6 718 279 62 703 968 91 312 800 249 192 281 529 725 842 307 954 173 71 540 54 763 975 717 98 40 773 269 890 867 88 729 712 477 386 562 346 447 715 348 607 74 171 470 784 475 679 274 660 741 29 5 232 205 385 70 239 126 437 440 664 618 118 588 323 125 9 373 623 213 729 14 860 754 525 137 919 564 137 716 856 478 702 212 43 727 402 505 805 18 914 785 729 443 421 816 884 548 897 893 571 528 820 656 311 914 522 380 738 315 912 773 750 170 953 837 655 863 229 448 713 44 995 975 891 459 188 71 544 879 741 299 714 415 907 544 459 774 881 464 403 864 643 938 597 184 1 866 773 432 752 42 686 928 286 724 79 932 381 441 185 487 591 776 298 416 310 604 975 99 814 414 186 823 36 242 915 775 342 190 713 787 10 598 417 309 285 674 800 654 848 691 957 752 672 475 557 928 943 531 …
Output: 914

Constraints:

1 <= k <= n <= 407; 0 <= a[i] <= 1000.

Loading...
Test Cases:No test cases
No test cases available.
Potter and the Shimmering weights - EASY Coding Problem | CodeTikki