Cod sursa(job #1624102)

Utilizator Andrei_SMSmadea Andrei Andrei_SM Data 2 martie 2016 00:31:56
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <iostream>
#include <fstream>
#include <vector>
#include <math.h>
#include <string>
#include <cstdlib>
using namespace std;
int main()
{
    int s=0,n;
    string a;
    ifstream f ("cifra.in");
    ofstream g ("cifra.out");
    vector<int> x;
    f>>n;
    for(int i=0; i<n; i++)
    {
        f>>a;
  int b = std::atoi(a.c_str());
        s+=pow(b,b);
        g<<s%10;
    }
    f.close();
    g.close();

}