-
Notifications
You must be signed in to change notification settings - Fork 0
/
1072.php
39 lines (27 loc) · 878 Bytes
/
1072.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
// beecrowd | 1072
// Interval 2
// Adapted by Neilor Tonin, URI Brazil
// Timelimit: 1
// Read an integer N. This N will be the number of integer numbers X that will be read.
// Print how many these numbers X are in the interval [10,20] and how many values are out of this interval.
// Input
// The first line of input is an integer N (N < 10000), that indicates the total number of test cases.
// Each case is an integer number X (-107 < X < 107).
// Output
// For each test case, print how many numbers are in and how many values are out of the interval.
$qntd_test = intval(fgets(STDIN));
$numbers = [];
for ($i = 0; $i < $qntd_test; $i++) {
$numbers[] = intval(fgets(STDIN));
}
[$in, $out] = 0;
foreach($numbers as $number){
if($number >= 10 && $number <= 20){
$in++;
}else{
$out++;
}
}
echo "$in in\n";
echo "$out out\n";