7 669
订阅者
-824 小时
-407 天
+2030 天
帖子存档
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n= sc.nextInt();
int x=sc.nextInt();
int[] arr=new int[n];
for(int i=0;i<n;i++) {
arr[i] = sc.nextInt();
}
System.out.println(Arrays.binarySearch(arr,x)>=0 ? (Arrays.binarySearch(arr,x)):-1);
}
}
#BIRLASOFT
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int K = sc.nextInt();
int[] arr = new int[N];
for (int i = 0; i < N; i++) {
arr[i] = sc.nextInt();
}
double avg= 0;
int sum = 0;
for (int i = 0; i < K; i++) {
sum += arr[i];
}
avg = (double) sum / K;
for (int i = K; i < N; i++) {
sum = sum - arr[i - K] + arr[i];
double cur = (double) sum / K;
if (cur > avg) {
avg = cur;
}
}
System.out.printf("%.2f\n", avg);
sc.close();
}
}
#wipro BIRLASOFT
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n= sc.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
int curSum=0;
for(int i=0;i<n;i++){
curSum+=arr[i];
if(curSum%(i+1)==0){
System.out.println("1 ");
}else{
System.out.println("0 ");
}
}
}
}
#BIRLASOFT
Got selected for IBM & Got IBM letter 🥳🥳 🎉🎉 ✅✅
IBM CIC recruitment process :
IBM coding(online) ✅
Communication(online) ✅
Coding(offline) ✅
video recorded session (offline) ✅
GD(offline) ✅
Interview (offline ) ✅
We cleared each and everything through guidance and finally we delivered ✅
💯 Clearance for any exam and interview ✅
Contact: @MLCODER2
现已上线!2025 年 Telegram 研究 — 年度关键洞察 
