核电站问题

This commit is contained in:
James 2020-03-23 20:44:14 +08:00
parent 2d2b47caec
commit 6cf3c5016d
8 changed files with 52 additions and 4 deletions

View File

@ -0,0 +1,20 @@
#include<iostream>
using namespace std;
int main(){
long long n,m,f[52][6]={0};
cin>>n>>m;
f[0][0]=1;
f[1][0]=1;
for(int i=1;i<=n;i++){
//cout<<f[i][0]<<" ";
f[i+1][0]=f[i][0];
for(int j=1;j<=m-1;j++){
f[i][j]=f[i-1][j-1];
f[i+1][0]+=f[i][j];
if(j==i) break;
//cout<<f[i][j]<<" ";
}
//cout<<endl;
}
cout<<f[n+1][0];
}

Binary file not shown.

View File

@ -0,0 +1 @@
4 3

View File

@ -0,0 +1 @@
5 3

View File

@ -0,0 +1 @@
3 2

View File

@ -0,0 +1 @@
49 5

View File

@ -0,0 +1 @@
49 2

View File

@ -1,7 +1,30 @@
## z:\Chao\src\Template\test\in.txt
2020/03/14 ÖÜÁù 11:41:28.68
Hello Easy C++ project!
## z:\Chao\src\1799_01choesornot\test\in.txt
2020/03/22 ÖÜÈÕ 13:02:25.04
13
-----------------------------------------------
Process exited after 200 ms with return value 0
## z:\Chao\src\1799_01choesornot\test\in2.txt
2020/03/22 ÖÜÈÕ 13:02:25.04
24
-----------------------------------------------
Process exited after 90 ms with return value 0
## z:\Chao\src\1799_01choesornot\test\in3.txt
2020/03/22 ÖÜÈÕ 13:02:25.04
5
-----------------------------------------------
Process exited after 80 ms with return value 0
## z:\Chao\src\1799_01choesornot\test\ince.txt
2020/03/22 ÖÜÈÕ 13:02:25.04
256641310658978
-----------------------------------------------
Process exited after 90 ms with return value 0
## z:\Chao\src\1799_01choesornot\test\ince2.txt
2020/03/22 ÖÜÈÕ 13:02:25.04
20365011074
-----------------------------------------------
Process exited after 80 ms with return value 0