HackerEarth Divisible problem solution

In this HackerEarth Split houses problem solution, you are given an array A of size N that contains integers. Here, N is an even number. You are required to perform the following operations:
  1. Divide the array of numbers in two equal halves
  2. Note: Here, two equal parts of a test case are created by dividing the array into two equal parts.
  3. Take the first digit of the numbers that are available in the first half of the array (first 50% of the test case)
  4. Take the last digit of the numbers that are available in the second half of the array (second 50% of the test case)
  5. Generate a number by using the digits that have been selected in the above steps
Your task is to determine whether the newly-generated number is divisible by 11.

hackerEarth Divisible problem solution

HackerEarth Divisible problem solution.

using namespace std;
#define ll long long
#define mod 1000000007ll
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define db(x) cout << #x << " = " << x << '\n'
int main(int argc, char const *argv[]) {

return 0;

second solution

#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define vll vector<ll>
#define llin(a) ll a; cin>>a;
#define llin2(a,b) ll a,b; cin>>a>>b;
#define llin3(a,b,c) ll a,b,c; cin>>a>>b>>c;
#define fulll(v) v.begin(),v.end()
#define vecin(n, v) for(ll i=0; i<n;i++) cin>>v[i];
#define vecout(n, v) for(ll i=0; i<n;i++) cout<<v[i]<<" "; cout<<endl;
#define rep(i, s, n) for(ll i=(ll)s;i<(ll)n;i++)
#define rrep(i, s, n) for(ll i=(ll)s;i>=(ll)n;i--)
#define pb push_back
#define mkp make_pair
#define endl "\n"
#define test cout<<"test line"<<endl;
#define swapper void swap(ll *a, ll *b){ll t=*a;*a=*b;*b=t;}
#define pll pair<ll,ll>
#define vpll vector<pll >
#define mod 1000000007
#define INF 0x3f3f3f3f
#define MAX 100005

using namespace std;

int main(){

assert(n>=1 && n<=100000);
ll se=0, so=0;
string s;
stringstream check(s);
ll val;
assert(val>=1 && val<=100000);
return 0;

Post a Comment