Cod sursa(job #1335421)

Utilizator ccsgeorge1Cocis George ccsgeorge1 Data 5 februarie 2015 14:55:06
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <iostream>
#include <fstream>
using namespace std;
int t,v[1000],s,p,i,j,x,h;
int main()
{
    ifstream f ("cifra.in");
    ofstream g ("cifra.out");
    f>>t;
    for (i=1;i<=t;i++)
        f>>v[i];
    for (i=1;i<=t;i++)
    {
        x=v[i];
        s=0;
        for (j=1;j<=x;j++)
        {
            t=j;
            p=1;
            for (h=1;h<=t;h++)
                p=p*j;
        }
        s=s+p;
        g<<s;
    }
    return 0;
}