File tree Expand file tree Collapse file tree 6 files changed +93
-0
lines changed Expand file tree Collapse file tree 6 files changed +93
-0
lines changed Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ using namespace std ;
3+
4+ int main () {
5+ int t;
6+ cin>>t;
7+ while (t--) {
8+ int N;
9+ cin>>N;
10+ int A[N], ans[N];
11+
12+ for (int i = 0 ; i < N; i++)
13+ cin>>A[i];
14+
15+ int s;
16+ for (int i = 0 ; i < N; i++) {
17+ s = 0 ;
18+ for (int j = i; j < N; j++) {
19+ if (A[j] == A[i])
20+ continue ;
21+ else
22+ s++;
23+ }
24+ ans[i] = s;
25+ }
26+ for (int i = 0 ; i < N; i++)
27+ cout<<ans[i]<<" " ;
28+ cout<<endl;
29+ }
30+ }
Original file line number Diff line number Diff line change 1+ t = int (input ())
2+
3+
4+ while t :
5+ N = int (input ())
6+ A = list (map (int , input ().split ()))
7+
8+ c = 0
9+ for i in range (N ):
10+ for j in range (i + 1 , N ):
11+ if A [i ]< A [j ]:
12+ c = c + 1
13+ print (c , end = ' ' )
14+ c = 0
15+
16+ t = t - 1
Original file line number Diff line number Diff line change 1+ ### https://www.codechef.com/problems/BIT2A
Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ using namespace std ;
3+
4+ int main () {
5+ int t,a[10000 ],N,f=0 ;
6+ cin>>t;
7+ while (t>0 ) {
8+ cin>>N;
9+ for (int i=0 ;i<N;i++) {
10+ cin>>a[i];
11+ if (a[i]%2 ==0 )
12+ {
13+ f=1 ;
14+ }
15+ }
16+ if (f==0 ) {
17+ cout<<" YES" ;
18+ }
19+ else {
20+ cout<<" NO" ;
21+ }
22+ cout<<endl;
23+ f=0 ;
24+ t--;
25+ }
26+ }
Original file line number Diff line number Diff line change 1+ t = int (input ())
2+
3+
4+ while t :
5+ N = int (input ())
6+
7+ A = list (map (int , input ().split ()))
8+ l = 1
9+
10+ for i in A :
11+ l *= i
12+
13+ if l % 2 == 0 :
14+ print ("NO" )
15+ else :
16+ print ("YES" )
17+
18+
19+ t = t - 1
Original file line number Diff line number Diff line change 1+ ### https://www.codechef.com/problems/CLLCM
You can’t perform that action at this time.
0 commit comments