Beecrowd 1174 – Array Selection I Solution in C
#include <stdio.h>
int main() {
double A[100];int i;
for(i=0;i<100;i++){
scanf("%lf",&A[i]);
}
for(i=0;i<100;i++){
if(A[i]<=10){
printf("A[%d] = %.1lf\n",i,A[i]);//Beecrowd 1174 - Array Selection I
}
}
return 0;
}
Beecrowd 1174 – Array Selection I Solution in CPP
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
double A[100];
for (int i = 0; i < 100; i++) {
cin >> A[i];
}
for (int i = 0; i < 100; i++) {
if (A[i] <= 10) {
cout << "A[" << i << "] = " << fixed << setprecision(1) << A[i] << endl;
}
}
return 0;
}
Beecrowd 1174 Solution in Java
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double[] A = new double[100];
for (int i = 0; i < 100; i++) {
A[i] = scanner.nextDouble();
}
for (int i = 0; i < 100; i++) {
if (A[i] <= 10) {
System.out.printf("A[%d] = %.1f%n", i, A[i]);
}
}
}
}
Beecrowd 1174 Solution in Python
A = [float(input()) for _ in range(100)]
for i in range(100):
if A[i] <= 10:
print(f"A[{i}] = {A[i]:.1f}")