Created
November 1, 2012 15:19
-
-
Save Abreto/3994267 to your computer and use it in GitHub Desktop.
UVaOJ 568 - Just the Facts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* UVaOJ 568 - Just the Facts */ | |
| #include <stdio.h> | |
| int main(void) | |
| { | |
| int N = 0; | |
| while( scanf("%d", &N)==1 ) | |
| { | |
| int i = 0; | |
| long long facts = 1; | |
| for(i = 1;i < N+1;i++) | |
| { | |
| facts *= i; | |
| while(facts%10 == 0) facts /= 10; // 舍弃末尾所有的〇 | |
| facts %= 100000000; // 取最后8位 | |
| } | |
| printf("%5d -> %lld\n", N, facts%10); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment