Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include <cstdio>
int main(){
const int LIMIT = 100;
int numSticks; scanf("%d", &numSticks);
int array[LIMIT + 1] = {0};
int temp(0), total(0);
for(int k = 0; k < numSticks; k++){scanf("%d", &temp); ++array[temp];}
for(int k = 0; k <= LIMIT; k++){ total += array[k] / 2;}
total /= 2;
printf("%d\n", total);
return 0;
}
Copy The Code &
Try With Live Editor
Input
5
2 4 3 2 3
2 4 3 2 3
Output
1
Demonstration
Codeforces Solution-B. Canvas Frames-Solution in C, C++, Java, Python