About Me

About Me : I have been working as a Software Engineer for various international companies for four years.Currently, I am working as a full stack Javascript developer in Petronas(Malaysia).

Skills

Skills • Javascript •Typescript •Python •C •Java •ReactJs • Redux • VueJs • NestJs • React Testing Library • Django• PostgreSQL • MySQL • NodeJs • Git • Docker • Jira • Visual Studio Code • Slack

রবিবার, ৮ নভেম্বর, ২০১৫

Spoj Solution:CRDS - Cards

#include <bits/stdc++.h>
#define pi acos(-1.0)

using namespace std;

typedef long long ll;
typedef  unsigned  long long ull;
typedef vector<int>vc;
vector<vc>graph;
int xr[]= {-1,-1,-1,0,0,1,1,1};
int yc[]= {-1,0,1,-1,1,-1,0,1};

int main()
{
    // freopen("input.txt","r",stdin);

    ll mod=1000007;
    int test;
    scanf("%d",&test);
    ll a,b;
    while(test--)
    {
        ll n,m;
        scanf("%lld",&n);
        m=n-1;
        a=((n%2==0)?((n/2)*(n+1))%mod:((n)*((n+1)/2))%mod);
        b=((m%2==0)?((m/2)*(m+1))%mod:((m)*((m+1)/2))%mod);
     //   cout<<a<<b<<endl;
        a=(a*2)%mod;
        printf("%lld\n",(a+b)%mod);

    }

    return 0;
}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন