Cod sursa(job #829016)

Utilizator datBumbleBPanainte Adrian datBumbleB Data 4 decembrie 2012 19:41:03
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 kb
#include<iostream>
#include<fstream>
using namespace std;

ifstream fin("fact.in");
ofstream fout("fact.out");

int main(){

    int n, nr = 0, i;
     long long prod = 1;
    cin >> n;
    for( i = 1; nr < n; i++){
        if(i % 5 == 0 && i % 10 != 0){
            nr ++;
            int x = i;
        while(x){
        x /= 5;
        if(x % 5 == 0) nr ++;
        else break;
        }
        }
        if(i % 10 == 0){
        nr ++;
        int y = i;
        while(y){
        y /= 10;
        if(i % 10 == 0)nr ++;
        }
        }
    }
    cout << i;
}