Skip to content

Commit fc8b739

Browse files
👾
1 parent 6566048 commit fc8b739

File tree

6 files changed

+93
-0
lines changed

6 files changed

+93
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
### https://www.codechef.com/problems/BIT2A
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
### https://www.codechef.com/problems/CLLCM

0 commit comments

Comments
 (0)