CT25732

Sable's Distinct Count Ledger

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Sable runs the granary at the kelp forests of Tangledeep. Today the books show a list of lanterns, and the numbers must be worked out before sundown. Task: Read n integers and print the number of distinct values. Input format: First line: n. Second line: n space-separated integers. Output format: Print the count of distinct values. Constraints: 1 <= n <= 511; -100 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 9 847 294 857 857 901 121 129 649 185
Output: 8

Example 2:

Input: 364 680 303 923 619 -65 891 486 501 147 167 319 466 877 81 912 926 554 7 352 518 102 -95 -3 244 567 754 84 -91 867 3 308 299 224 329 -3 409 208 687 739 426 463 115 795 26 286 116 736 301 469 545 479 -54 213 -46 462 781 9 909 62 -32 -78 457 969 304 933 541 128 539 -46 738 157 844 656 969 317 523 -58 35 87 900 481 79 974 -71 952 -71 973 681 562 -50 390 612 270 571 675 91 878 187 480 847 537 685 410 660 890 660 129 470 548 805 -19 559 583 661 162 4 929 700 872 579 856 35 -43 142 387 891 264 803 142 798 905 662 481 618 908 972 -56 348 336 998 247 287 582 511 589 859 451 587 872 965 675 223 905 592 647 931 627 -81 781 980 374 40 233 414 434 780 54 802 733 786 130 491 531 604 333 201 538 197 434 250 462 764 218 226 132 925 682 348 231 689 866 343 187 76 289 98 172 580 87 25 523 427 192 183 991 -…
Output: 312

Example 3:

Input: 215 699 431 331 463 226 812 768 841 740 94 71 710 267 4 849 -37 723 120 523 959 473 -6 396 127 860 320 80 925 810 893 955 498 -83 807 845 489 627 244 13 439 106 570 496 431 406 624 754 477 44 450 874 226 438 66 254 284 929 441 956 951 117 -70 924 464 696 163 112 759 936 856 368 -13 175 212 877 801 983 458 471 135 660 369 80 960 234 993 794 154 264 122 -66 455 967 267 23 470 157 417 831 465 945 114 492 276 217 933 201 368 719 886 158 100 153 70 618 861 213 794 -14 225 121 488 794 324 860 573 622 497 346 508 762 523 329 247 863 781 309 539 -18 335 318 391 583 576 452 -85 327 378 268 951 778 238 115 353 533 206 196 607 855 594 -57 922 846 827 272 338 511 250 38 772 775 464 834 203 602 157 373 979 972 513 362 277 602 950 990 76 487 477 376 75 137 729 975 416 312 823 953 351 12 887 718 820 996 …
Output: 198

Constraints:

1 <= n <= 511; -100 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Loading...
Test Cases:No test cases
No test cases available.