How to solve this Problems "to-do list" in php

Hi,

I’m a php developer and I’m facing problem while solving this (CodeChef), can anyone please help me out here.
How to solve this problem using PHP. I have used fscanf for taking input but I don’t know how to make STDIN dynamically where we can pass as many as par the questions to pass in the testcase.

If you are able to take input and output and familiar with basic syntax then you will try these approach

#include
using namespace std;

int main() {
// your code goes here
// t take how many test case are passed
int t;
cin >> t;

while(t > 0){

// it takes n number of input in an array
int n;
cin >> n;

    int arr[n];

// it takes input in the array
for(int i = 0; i<n; i++){
cin >> arr[i];
}

// we take global variable for counting the element which are greater than or equal to 1000 and store them into this variable.
int count = 0;

//then try making codition
for(int i = 0; i<n; i++){
if(arr[i] >= 1000){
count++;
}
}
t–;
cout << count << endl;
}
return 0;
}

1 Like