WhiteHat Coding
Kanalga Telegramāda oātish
Sharing = caring = spreading happiness
Ko'proq ko'rsatish650
Obunachilar
Ma'lumot yo'q24 soatlar
-27 kunlar
-330 kunlar
Postlar arxiv
Placement code
#include <stdio.h>
int main() {
Ā Ā Ā int n;
Ā Ā Ā scanf("%d", &n);
Ā Ā Ā int psc[n], ans[n];
Ā Ā Ā for (int i = 0; i < n; i++) {
Ā Ā Ā Ā Ā Ā Ā scanf("%d", &psc[i]);
Ā Ā Ā Ā Ā Ā Ā ans[i] = 0;
Ā Ā Ā Ā Ā Ā Ā for (int j = 0; j < i; j++) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā if (psc[j] > psc[i]) {
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ans[i]++;
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā Ā Ā Ā Ā }
Ā Ā Ā }
Ā Ā Ā for (int i = 0; i < n; i++) {
Ā Ā Ā Ā Ā Ā Ā printf("%d ", ans[i]);
Ā Ā Ā }
Ā Ā Ā printf("\n");
Ā Ā Ā return 0;
}
placement codeā
package john;
import java.util.Scanner;
public class John {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int X = scan.nextInt();
int Parent[] = new int[N];
int sub[] = new int[N];
int c = 0;
for(int i=0; i<N; ++i)
{
Parent[i] =scan.nextInt();
if(Parent[i] != -1)
++sub[Parent[i]];
}
for(int i=0; i<N; ++i)
{
if(sub[i] >= X)
++c;
}
System.out.println(c);
}
}
Java
Parents Codeā
Share our channel screenshot in large groups ā
ā
ā
ā
ā
For coding answers šššš
