Cod sursa(job #1524046)

Utilizator stefdascalescuStefan Dascalescu stefdascalescu Data 13 noiembrie 2015 15:21:18
Problema Patrate2 Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include<fstream>
using namespace std;
ifstream f("patrate2.in");
ofstream g("patrate2.out");
int n,i,v1[500],q=1,t,j;
int main()
{
    f>>n;
    n=n*4-3;
    v1[1]=1;
    for(i=1;i<=n;++i)
    {
        t=0;
        for(j=1;j<=q;++j){
            v1[j]=v1[j]*2+t;
            t=v1[j]/10;
            v1[j]=v1[j]%10;
        }
        v1[q+1]=t;
        if(v1[q+1]>0)
            ++q;
    }
    for(i=q;i>=1;--i)
        g<<v1[i];
    return 0;
}