Cod sursa(job #1132225)

Utilizator 0xdalvVlad Stoica 0xdalv Data 2 martie 2014 21:37:44
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;
    for (unsigned long long int i=1; i<=n; i++) {
      suma += pow(i, i);
    }
    g << suma%10;
  }
  return 0;
}