arrow_forward
همه ارسالها
جزئیات ارسال کد#399
برای پسندیدن وارد شوید
1#include <iostream>
2#include <stdio.h>
3
4using namespace std;
5
6int main(){
7
8 int n ;
9 cin >> n;
10 int house_s = 0;
11 int counter = 0;
12 int array [2*n];
13 bool array2 [2*n] = {false};
14
15 for(int i=0 ; i<2*n ; i++){
16 cin >> array[i];
17 }
18
19 for(int i= house_s ; i<(2*n) ; i++){
20 if(array2[i]== true){
21 continue;
22 }
23 for(int j=i+1; j< (2*n) ; j++){
24
25 if(array2[j]== true){
26 continue;
27 }
28
29 if(array[i]==array[j]){
30 counter += j - i;
31 array2[i]=true;
32 array2[j]=true;
33 break;
34 }
35 }
36 }
37
38 cout << counter ;
39
40 return 0;
41}
کد ارسالشده برای داوری خودکار هاتکدز
UTF-8