foj Problem 2282 Wand】的更多相关文章

 Problem 2282 Wand Accept: 432    Submit: 1537Time Limit: 1000 mSec    Memory Limit : 262144 KB Problem Description N wizards are attending a meeting. Everyone has his own magic wand. N magic wands was put in a line, numbered from 1 to n(Wand_i owned…
 Problem 1759 Super A^B mod C Accept: 1368    Submit: 4639Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description Given A,B,C, You should quickly calculate the result of A^B mod C. (1<=A,C<=1000000000,1<=B<=10^1000000).  Input Th…
 Problem 1016 无归之室 Accept: 926    Submit: 7502Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description 金字塔中有一个房间名叫“无归之室”.房间地面完全由相同的矩形瓷砖覆盖.房间里布满无数的机关和陷阱,这正是其名字的由来.考古队花了几年时间研究对策,最后他们想出了一个方案.一台遥控的机器人将被送入房间,解除所有机关,然后返回.为了不触动机关,机器人必须走在瓷砖的中心区域…
Problem 1015 土地划分 Accept: 823    Submit: 1956Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description 在Dukeswood这块土地上生活着一个富有的农庄主和他的几个孩子.在他临终时,他想把他的土地分给他的孩子.他有许多农场,每个农场都是一块矩形土地.他在农场地图上划上一些直线将矩形分成若干块.当他划直线时,他总是从矩形边界上的某一点划到另一个矩形边界上的点,这条线的结束…
Problem 2107 Hua Rong Dao Accept: 503    Submit: 1054Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description Cao Cao was hunted down by thousands of enemy soldiers when he escaped from Hua Rong Dao. Assuming Hua Rong Dao is a narrow aisl…
Problem 2273 Triangles Accept: 201    Submit: 661Time Limit: 1000 mSec    Memory Limit : 262144 KB Problem Description This is a simple problem. Given two triangles A and B, you should determine they are intersect, contain or disjoint. (Public edge o…
Problem D Game Accept: 145    Submit: 844Time Limit: 1000 mSec    Memory Limit : 262144 KB Problem Description Alice and Bob is playing a game. Each of them has a number. Alice’s number is A, and Bob’s number is B. Each turn, one player can do one of…
                                                                                                Problem 2283 Tic-Tac-Toe Accept: 60    Submit: 92Time Limit: 1000 mSec    Memory Limit : 262144 KB Problem Description Kim likes to play Tic-Tac-Toe. Give…
                                                                                                                                                                                                                               Problem 2257 Saya的小熊饼干 Acce…
                                                                                                                                                           Problem 2261 浪里个浪 Accept: 40    Submit: 106Time Limit: 1500 mSec    Memory Limit : 32768 KB Pro…
                                                                                                                                                                       Problem 2253 Salty Fish Accept: 35    Submit: 121Time Limit: 1000 mSec    Memory Li…
                                                                                                                                                                                    Problem 2254 英语考试 Accept: 36    Submit: 73Time Limit: 1000 mSec    Mem…
                                                                                                                                                                           Problem 2256 迷宫 Accept: 25    Submit: 52Time Limit: 1500 mSec    Memory Limit :…
                                                                                        Problem 2260 Card Game Accept: 37    Submit: 117Time Limit: 3000 mSec    Memory Limit : 32768 KB Problem Description 有如下取牌游戏: 1. 桌面上有n张卡牌从左到右排成一行,每张卡牌上有一个数字: 2. 游…
Problem 2271 X Accept: 55    Submit: 200Time Limit: 1500 mSec    Memory Limit : 32768 KB Problem Description X is a fully prosperous country, especially known for its complicated transportation networks. But recently, for the sake of better controlli…
整体思路:对于每一位,先将当前未达到$limit$部分的段 [如 $0$ ~ $10000$] 直接处理好,到下一位时再处理达到$limit$的部分. · $1 × 10 ^ n$以内每个数(包括$0$)的出现次数的计算 [即已知$bitnum[n - 1]$,求$bitnum[n]$]: 将$bitnum[n - 1]$乘以$10$,代表$n - 1$处最为每个小段在$n$处出现$10$次,再加上$power10[n - 1]$,即加上新增的最高位该数出现次数. · $1 × 10 ^ n$以…
Problem 2020 组合 Accept: 714    Submit: 1724Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description 给出组合数C(n,m), 表示从n个元素中选出m个元素的方案数.例如C(5,2) = 10, C(4,2) = 6.可是当n,m比较大的时候,C(n,m)很大!于是xiaobo希望你输出 C(n,m) mod p的值!  Input 输入数据第一行是一个正整数T,表示数据组…
[题目链接] http://poj.org/problem?id=2282 [算法] 数位DP [代码] #include <algorithm> #include <bitset> #include <cctype> #include <cerrno> #include <clocale> #include <cmath> #include <complex> #include <cstdio> #inclu…
Problem 2082 过路费 Accept: 382    Submit: 1279 Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description 有n座城市,由n-1条路相连通,使得随意两座城市之间可达.每条路有过路费,要交过路费才干通过.每条路的过路费常常会更新,现问你,当前情况下,从城市a到城市b最少要花多少过路费. Input 有多组例子,每组例子第一行输入两个正整数n,m(2 <= n<=50000,1&…
题目链接: http://acm.fzu.edu.cn/problem.php?pid=2238 题目大意: 已知等差数列A(0)的首项a和公差d,求出数列A(0)前n项和,得到新数列A(1);以此类推,最终求A(m)的第i项mod1000000007 题目思路: [动态规划] 不难推出c[i][j]=c[i-1][j]+c[i][j-1] 但是i太大不能直接递推,m<=1000不能矩阵快速幂. 通过推导可以求出c[i][j]=a*C(n+m-1,n-1)+d*C(n+m-1,n-2) 求模时除…
N wizards are attending a meeting. Everyone has his own magic wand. N magic wands was put in a line, numbered from 1 to n(Wand_i owned by wizard_i). After the meeting, n wizards will take a wand one by one in the order of 1 to n. A boring wizard deci…
Problem 2111 Min Number Accept: 1025    Submit: 2022Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description Now you are given one non-negative integer n in 10-base notation, it will only contain digits ('0'-'9'). You are allowed to choos…
Problem 2082 过路费    Problem Description 有n座城市,由n-1条路相连通,使得任意两座城市之间可达.每条路有过路费,要交过路费才能通过.每条路的过路费经常会更新,现问你,当前情况下,从城市a到城市b最少要花多少过路费.  Input 有多组样例,每组样例第一行输入两个正整数n,m(2 <= n<=50000,1<=m <= 50000),接下来n-1行,每行3个正整数a b c,(1 <= a,b <= n , a != b , 1…
http://acm.fzu.edu.cn/problem.php?pid=2179 Problem 2179 chriswho Accept: 57    Submit: 136 Time Limit: 10000 mSec    Memory Limit : 327680 KB  Problem Description Chriswho很喜欢数字,特别喜欢一种数字,它能整除它的每一位数字(如果该位是0当做能整除),比如说126这个数字他就很喜欢,因为126%1=126%2=126%6=0.为…
http://acm.fzu.edu.cn/problem.php?pid=2182 Problem 2182 水题 Accept: 188    Submit: 277Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description 胖哥自从当上公务员,赢取白富美,走向人生巅峰后,已经懒散到不想出题了,不仅如此,他连题目都懒得看了,现在他只会根据题目第一个单词的长度判定这个题目的难度 如果题目的第一个单词太长(长度大于3…
题目:http://acm.fzu.edu.cn/problem.php?pid=2082 Problem 2082 过路费 Accept: 528    Submit: 1654Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description 有n座城市,由n-1条路相连通,使得任意两座城市之间可达.每条路有过路费,要交过路费才能通过.每条路的过路费经常会更新,现问你,当前情况下,从城市a到城市b最少要花多少过路费.  …
Problem 1692 Key problem Accept: 103    Submit: 553 Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description Whenever rxw meets Coral, he requires her to give him the laboratory key. Coral does not want to give him the key, so Coral ask h…
题目链接:http://acm.fzu.edu.cn/problem.php?pid=2282 编号1~n的置换,不动点个数大于等于k的方案数. 参考百度百科错排公式,可以知道长度为n,每个数都不在自己位置的方案数.然后枚举长度即可. 考虑对立面(即小于k个在自己位置的)可以优化空间. #include<cstdio> #include<algorithm> using namespace std; ; ; int D[maxn]; ]; int F[maxn]; int main…
题目链接:https://vjudge.net/problem/FZU-2013  Problem 2013 A short problem Accept: 356    Submit: 1083Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description The description of this problem is very short. Now give you a string(length N), an…
Problem 2200 cleaning  Problem Description N个人围成一圈在讨论大扫除的事情,需要选出K个人.但是每个人与他距离为2的人存在矛盾,所以这K个人中任意两个人的距离不能为2,他们想知道共有多少种方法.  Input 第一行包含一个数T(T<=100),表示测试数据的个数. 接下来每行有两个数N,K,N表示人数,K表示需要的人数(1<=N<=1000,1<=K<=N).  Output 输出满足题意的方案数,方案数很大,所以请输出方案数mo…