apple and orange hackerrank solution in c++
C++
#include<iostream>
using namespace std;
int main()
{
int s,t,a,b,m,n;
cin>>s>>t>>a>>b>>m>>n;
int arr[m];
int arr1[n];
int apple=0;
int orange=0;
for(int i=0;i<m;i++){
cin>>arr[i];
if(a+arr[i]>=s && a+arr[i]<=t){
apple++;
}
}
for(int i=0;i<n;i++){
cin>>arr1[i];
if(b+arr1[i]>=s && b+arr1[i]<=t){
orange++;
}
}
cout<<apple<<endl<<orange<<endl;
}
Also in C++:
- Title
- memset
- Category
- C++
- Title
- c++ remove text file
- Category
- C++
- Title
- sort function in vector c++ stl
- Category
- C++
- Title
- calling by reference and pointers c++
- Category
- C++
- Title
- how to find length of string in c++
- Category
- C++
- Title
- hohw toparse a string in c++
- Category
- C++
- Title
- inconsequential meaning
- Category
- C++
- Title
- how to sort an array according to another array c++
- Category
- C++
- Title
- how to print nth palindrome number in c++
- Category
- C++
- Title
- maximum subarray sum in c++
- Category
- C++
- Title
- initialize array c++
- Category
- C++
- Title
- string input
- Category
- C++
- Title
- how to delete a node c++
- Category
- C++
- Title
- how to make a switch case statement in c++
- Category
- C++
- Title
- graph using djacency matrix c++
- Category
- C++
- Title
- if vector contains value c++
- Category
- C++
- Title
- Combination Sum
- Category
- C++
- Title
- visual studio 2019 read and write text file c++
- Category
- C++
- Title
- string to vector c++
- Category
- C++
- Title
- how to convert a string to a double c++
- Category
- C++
- Title
- how to print for limited decimal values in c++
- Category
- C++
- Title
- c++ char print align
- Category
- C++
- Title
- sort function in cpp
- Category
- C++
- Title
- c++ code to print hello world
- Category
- C++
- Title
- make an x using asterisk c++
- Category
- C++
- Title
- c++ scanf
- Category
- C++
- Title
- binary representation differ in bits
- Category
- C++
- Title
- c++ sort array of ints
- Category
- C++
- Title
- ue4 c++ struct
- Category
- C++
- Title
- cpp loop through object
- Category
- C++
- Title
- switch c++
- Category
- C++
- Title
- c++ overloaded equality check operator
- Category
- C++
- Title
- how initilaize deffult value to c++ class
- Category
- C++
- Title
- cannot jump from switch statement to this case label c++
- Category
- C++
- Title
- what is meaning of 64 bit integer in c++
- Category
- C++
- Title
- c++ ros subscriber
- Category
- C++
- Title
- vector initialization c++
- Category
- C++
- Title
- power in c++
- Category
- C++
- Title
- checking an int in c++
- Category
- C++
- Title
- how to turn int into string c++
- Category
- C++
- Title
- how to make a heap using stl in c++
- Category
- C++
- Title
- c++ cout int
- Category
- C++
- Title
- maximum possible number atmost k swaps
- Category
- C++
- Title
- recursive in c++
- Category
- C++
- Title
- cpp pi from acos
- Category
- C++
- Title
- check if key exists in map c++
- Category
- C++
- Title
- convert integer to string c++
- Category
- C++
- Title
- sum of integer in array c++
- Category
- C++
- Title
- c++ how to add something at the start of a vector
- Category
- C++
- Title
- create new file c++
- Category
- C++
- Title
- create a dictionary cpp
- Category
- C++
- Title
- c++ tutorial
- Category
- C++
- Title
- cin.fail()
- Category
- C++
- Title
- nearest integer rounding in c++
- Category
- C++
- Title
- new class * [] c++
- Category
- C++
- Title
- mysqli connect
- Category
- C++
- Title
- c++ excel cell blank cells
- Category
- C++
- Title
- cpp how to create an object of template class
- Category
- C++
- Title
- unordered_map c++ insert
- Category
- C++
- Title
- powers of 2 in cpp
- Category
- C++
- Title
- c++ do while loop
- Category
- C++
- Title
- char* to int in cpp
- Category
- C++
- Title
- uepic games github
- Category
- C++
- Title
- declaration vs. definition cpp
- Category
- C++
- Title
- how to create object in c++
- Category
- C++
- Title
- add a timer c++
- Category
- C++
- Title
- min heap declaration in c++ stl
- Category
- C++
- Title
- set c++
- Category
- C++
- Title
- c++ crash windows
- Category
- C++
- Title
- unordered_map c++
- Category
- C++
- Title
- singleton c++
- Category
- C++
- Title
- compile c++ linux
- Category
- C++
- Title
- how the theam are store in database
- Category
- C++
- Title
- what is order in of preeendence in float, int, char, bool
- Category
- C++
- Title
- how to ensure the user inouts a int and not anything else c++
- Category
- C++
- Title
- initialize map c++
- Category
- C++
- Title
- C++ and endl
- Category
- C++
- Title
- lopping over an array c++
- Category
- C++
- Title
- input a string in c++
- Category
- C++
- Title
- char **
- Category
- C++
- Title
- c++ string^ to char*
- Category
- C++
- Title
- add two numbers in c++
- Category
- C++
- Title
- c++ pointers
- Category
- C++
- Title
- empty string c++ value
- Category
- C++
- Title
- system("pause") note working c++
- Category
- C++
- Title
- insert at position in vector c++
- Category
- C++
- Title
- convert GLFWwindow* to IntPtr
- Category
- C++
- Title
- reverse in vector c++
- Category
- C++
- Title
- array 2d to 1d
- Category
- C++
- Title
- rick astley - never gonna give you up
- Category
- C++
- Title
- % operator in c++
- Category
- C++
- Title
- find upper bound c++ vector
- Category
- C++
- Title
- appending a double to a string c++
- Category
- C++
- Title
- array<string, 7> c++
- Category
- C++
- Title
- map vs unordered_map in C++
- Category
- C++
- Title
- knapsack
- Category
- C++
- Title
- pointers in cpp
- Category
- C++
- Title
- c++ set add element
- Category
- C++
- Title
- c++ initialize a vector
- Category
- C++
- Title
- pass by reference c++
- Category
- C++