Cod sursa(job #1333449)

Utilizator ionut98Bejenariu Ionut Daniel ionut98 Data 3 februarie 2015 10:36:47
Problema 12-Perm Scor 95
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.31 kb
#include<fstream>
#define mod 1048576
using namespace std;
ifstream f("12perm.in");
ofstream g("12perm.out");
int n,t[15000001],i;
int main()
{
    f>>n;
    t[1]=1;
    t[2]=2;
    t[3]=6;
    t[4]=12;
    for(i=5;i<=n;i++)
      t[i]=(t[i-1]+t[i-3]+(2*(i-2)))%mod;
    g<<t[n];
    return 0;
}