这题注意要保存%10000的数。

 /*
 ID: yingzho1
 LANG: C++
 TASK: fact4
 */
 #include <iostream>
 #include <fstream>
 #include <string>
 #include <map>
 #include <vector>
 #include <set>
 #include <algorithm>
 #include <stdio.h>
 #include <queue>
 #include <cstring>
 #include <cmath>
 #include <list>
 #include <cstdio>
 #include <cstdlib>

 using namespace std;

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

 ;

 int N;

 int main()
 {
     fin >> N;
     vector<);
     f[] = ;
     ; i < f.size(); i++) {
         //cout << f[i-1] << endl;
         ]*i;
          == ) tmp /= ;
         f[i] = tmp % ;
     }
     fout << f[N] %  << endl;;

     ;
 }

USACO Section 3.2: Factorials的更多相关文章

  1. USACO Section 1.3 题解 (洛谷OJ P1209 P1444 P3650 P2693)

    usaco ch1.4 sort(d , d + c, [](int a, int b) -> bool { return a > b; }); 生成与过滤 generator&& ...

  2. USACO Section 3.3: Riding the Fences

    典型的找欧拉路径的题.先贴下USACO上找欧拉路径的法子: Pick a starting node and recurse on that node. At each step: If the no ...

  3. USACO Section 3.3 Camlot(BFS)

    BFS.先算出棋盘上每个点到各个点knight需要的步数:然后枚举所有点,其中再枚举king是自己到的还是knight带它去的(假如是knight带它的,枚举king周围的2格(网上都这么说,似乎是个 ...

  4. [IOI1996] USACO Section 5.3 Network of Schools(强连通分量)

    nocow上的题解很好. http://www.nocow.cn/index.php/USACO/schlnet 如何求强连通分量呢?对于此题,可以直接先用floyd,然后再判断. --------- ...

  5. USACO Section 5.3 Big Barn(dp)

    USACO前面好像有类似的题目..dp(i,j)=min(dp(i+1,j),dp(i+1,j+1),dp(i,j+1))+1  (坐标(i,j)处无tree;有tree自然dp(i,j)=0) .d ...

  6. USACO Section 1.3 Prime Cryptarithm 解题报告

    题目 题目描述 牛式的定义,我们首先需要看下面这个算式结构: * * * x * * ------- * * * <-- partial product 1 * * * <-- parti ...

  7. USACO Section 1.1 Your Ride Is Here 解题报告

    题目 问题描述 将字符串转变为数字,字母A对应的值为1,依次对应,字母Z对应的值为26.现在有一个字符串,将其中的每个字符转变为数字之后进行累乘,最终的结果对47求余数. 题目给你两个字符串,其中的字 ...

  8. USACO Section 1.1-1 Your Ride Is Here

    USACO 1.1-1 Your Ride Is Here 你的飞碟在这儿 众所周知,在每一个彗星后都有一只UFO.这些UFO时常来收集地球上的忠诚支持者.不幸的是,他们的飞碟每次出行都只能带上一组支 ...

  9. USACO section 1.1 C++题解

    USACO section1.1:DONE 2017.03.03 TEXT Submitting Solutions DONE 2017.03.04 PROB Your Ride Is Here [A ...

随机推荐

  1. 自动回复消息-微信公众平台开发4(asp.net)

    接着上一节的processRequest 处理函数,代码如下: /// <summary>    /// 处理微信发来的请求     /// </summary>    /// ...

  2. CSS3选择器学习笔记

    CSS选择器总结: 一.基本选择器 1.通配选择器:[  *  ]        选择文档中所以HTML元素. *{margin: 0;padding: 0;} /*选择页面中的所有元素并设置marg ...

  3. Invalid object name ‘sys.configurations’. (Microsoft SQL Server, Error: 208)

    http://blogs.msdn.com/b/ramaprasanna/archive/2009/09/16/invalid-object-name-sys-configurations-micro ...

  4. UML 用例图,时序图,活动图的定义以及区别

    1.用例图,时序图,活动图的定义 1.用例图:  用例图描述了系统提供的一个功能单元.用例图的主要目的是帮助开发团队以一种可视化的方式理解系统的功能需求,包括基于基本流程的"角色" ...

  5. topcoder 642

    A:直接拆开字符串写就好了. 今天的题目比较容易一些: B:题目大意: 求最少的翻转次数,每次翻转i是对应 y%i==0都会翻转. 球所有翻转为off状态的最小次数: 从最小idx开始,依次做就好了, ...

  6. How Big Is A Petabyte, Exabyte, Zettabyte, Or A Yottabyte?

    一个关于Byte递增的描述,蛮有趣的! Bytes -> Kilobyte -> Megabyte -> Gigabyte -> Terabyte -> Petabyte ...

  7. iOS第三方支付-微信支付

    微信支付用到的文件 1.首先支持非arc 2.设置URL types 3.AppDelegate - (BOOL)application:(UIApplication *)application di ...

  8. sql server 函数

    1.Fun_Split 分割字符串,形成返回表 CREATE FUNCTION [dbo].[Fun_Split] ( @Items VARCHAR(MAX), @SplitStr VARCHAR(M ...

  9. Tomcat内存溢出(java.lang.OutOfMemoryError: PermGen space)的解决办法

    Tomcat启动时报如下错误: java.lang.OutOfMemoryError: PermGen space 解决办法: 配置相关内存大小.其中按照启动tomcat的不同方式,分如下三种情况 a ...

  10. IOS笔记 #pragma mark的用法和作用(方便查找和导航代码)

    简单的来说就是为了方便查找和导航代码用的.   下面举例如何快速的定位到我已经标识过的代码.     #pragma mark 播放节拍器 - (void) Run:(NSNumber *)tick{ ...