-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path354B.cpp
More file actions
53 lines (44 loc) · 743 Bytes
/
354B.cpp
File metadata and controls
53 lines (44 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include<iostream>
using namespace std;
int arr[10][50];
int pw[11];
int n,t;
void add(int i,int j){
if(arr[i][j]!=pw[i]){
return;
}
if(i==n) return;
add(i+1,j);
add(i+1,j+1);
}
void print(){
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
cout<<arr[i][j]<<" ";
}
cout<<endl;
}
}
int result(){
for(int i=0;i<t;i++){
add(1,1);
}
int cnt = 0;
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
if(arr[i][j]==i){
cnt++;
}
}
}
return cnt;
}
int main(){
pw[1] = 1;
for(int i=2;i<=10;i++){
pw[i] = pw[i-1]*2;
}
cin>>n>>t;
cout<<result()<<endl;
print();
}