Cod sursa(job #1132226)

Utilizator 0xdalvVlad Stoica 0xdalv Data 2 martie 2014 21:38:18
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.34 kb
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;

int main() {
  fstream f("cifra.in", ios::in);
  fstream g("cifra.out", ios::out);
  int t; unsigned long long int n;
  while (f>>n) {
    int suma = 0;
    for (unsigned long long int i=1; i<=n; i++) {
      suma += pow(i, i);
    }
    g << suma%10;
  }
  return 0;
}