Cards
Link to the question : CRDS
HINT :
A very simple question. Just observe the pattern and derive a formula.
RECOMMENDED QUESTION :
Try this adhoc question .
SOURCE CODE :
#include<iostream> using namespace std; int main() { long long t,n,s; cin>>t; while(t--) { cin>>n; s= (2*n*(n+1)/2) + (n*(n-1)/2); cout<<s%1000007<<endl; } return 0; }
No comments:
Post a Comment