#include <cstdio>
#include <iostream>
using namespace std;
int fact[20000];
int main()
{
int i, f, idx;
fact[0] = fact[1] = 1;
f = 1;
for (i=2 ; i<=10000 ; i++)
{
f*=i;
while (f%10 == 0)
f/=10;
f = f%100000;
fact[i] = f%10;
}
while (scanf("%d",&idx)==1)
{
printf("%5d -> %d\n",idx,fact[idx]);
}
return 0;
}
Showing posts with label Factorials. Show all posts
Showing posts with label Factorials. Show all posts
Thursday, November 10, 2011
[UVa] 568 - Just the Facts
Subscribe to:
Posts (Atom)
Connect Rapoo MT750S with Linux (Tested on Manjaro)
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
I like coding a lot, keeps me glued to the PC for hours. For that reason it's a need to edit the Syntax Highlighter to suit my eyes for...
-
I've been constantly switching between my two OSs, Win7 and Linux Mint for just flashing a ROM to my Xperia device. And ofcourse, I hat...
-
Method: The problem at first glance seems too straightforward but it's not that much. Think a bit about the lines "Erin can add ...