Skip to content

Commit 0abeb30

Browse files
committed
practice 10-Jan-2020
1 parent e8aaa96 commit 0abeb30

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
int summ(int n){
5+
return (n*(n+1))/2;
6+
}
7+
8+
int main()
9+
{
10+
ios_base::sync_with_stdio(false);
11+
cin.tie(NULL);
12+
int t;
13+
cin>>t;
14+
while(t--){
15+
int d,n;
16+
cin>>d>>n;
17+
int res=n;
18+
while(d--){
19+
res=summ(res);
20+
}
21+
cout<<res<<endl;
22+
}
23+
24+
25+
return 0;
26+
}

0 commit comments

Comments
 (0)