Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Sock Merchant
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, g, s[111], tmp, ats=0;
- cin >> n;
- for(int i=0;i<n;i++)
- {
- cin >> s[i];
- }
- for(int i=0;i<n;i++)
- {
- for(int y=0;y<n-1;y++)
- {
- if(s[y]>s[y+1])
- {
- tmp = s[y];
- s[y] = s[y+1];
- s[y+1] = tmp;
- }
- }
- }
- g=n/2;
- for(int i=0;i<n;i++)
- {
- if(s[i]==s[i+1])
- {
- ats++;
- i++;
- }
- }
- cout << ats;
- return 0;
- }
Add Comment
Please, Sign In to add comment