Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #define N 2005
- #define M 100003
- using namespace std;
- ifstream fin("fractii2.in");
- ofstream fout("fractii2.out");
- int n, cer;
- int dp[N][N];
- void Cerinta1()
- {
- for(int i=1;i<n;i++)
- fout<<i<<" ";
- fout<<n-1;
- }
- void Cerinta2()
- {
- dp[2][1]=1;
- for(int i=3;i<=n;i++)
- for(int j=1;j<=i/2;j++)
- {
- dp[i][j]=dp[i][j-1]+dp[i-j][(i-j)/2]-dp[i-j][(j+1)/2-1];
- if(dp[i][j]<0)dp[i][j]+=M;
- if(dp[i][j]>=M) dp[i][j]-=M;
- }
- fout<<dp[n][n/2]<<"\n";
- }
- void Afisare()
- {
- for(int i=1;i<=n;i++)
- {
- for(int j=1;j<=n;j++)
- fout<<dp[i][j]<<" ";
- fout<<"\n";
- }
- }
- int main()
- {
- fin>>cer>>n;
- if(cer==1)Cerinta1();
- else {
- Cerinta2();
- ///Afisare();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement