Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Add/Update/Remove] - [Adit Chanchal] #845

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions COMPETITORS/competitors.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,7 @@
- [Pavlmits](https://github.com/Pavlmits)
---

#### Adit Chanchal
- [aditchanchal](https://github.com/aditchanchal)
---

58 changes: 58 additions & 0 deletions SOLUTIONS/Find Sum Square Difference.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007LL
#define sz(a) (ll)a.size()
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define sep(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define vl vector<ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pii pair<ll,ll>
#define mod 1000000007
#define MAXN 200002

/*static vector < ll >*base_arr;
bool compar (ll a, ll b)
{
return ((*base_arr)[a] < (*base_arr)[b]);
}*/

/*ll gcd(ll a, ll b)
{
// Everything divides 0
if (a == 0 || b == 0)
return 0;

// Base case
if (a == b)
return a;

// a is greater
if (a > b)
return gcd(a-b, b);
return gcd(a, b-a);
}*/

int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll t,n,u,l,ans;
cin>>t;
while(t--)
{
cin>>n;
u=(n*n*(n+1)*(n+1))/4;
l=(n*(n+1)*(2*n+1))/6;
ans=abs(u-l);
cout<<ans<<"\n";
}
return 0;
}