CodeForces 146A Lucky Ticket】的更多相关文章

Lucky Ticket Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 146A Description Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal…
Lucky Sum Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 121A64-bit integer IO format: %I64d      Java class name: (Any)     Petya loves lucky numbers. Everybody knows that lucky numbers are positive…
C. Lucky Numbers time limit per test 0.5 seconds memory limit per test 64 megabytes input standard input output standard output The numbers of all offices in the new building of the Tax Office of IT City will have lucky numbers. Lucky number is a num…
E. Lucky Queries time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains…
题意: 一个数只含有4,7就是lucky数...现在有一串长度为n的数...问这列数有多少个长度为k子串..这些子串不含两个相同的lucky数... 子串的定义..是从这列数中选出的数..只要序号不同..就不不同的串..如 1 1 的长度为1的子串有两个 题解: 解题前可以先求一下1000000000内有多少个数是lucky的...可以递推的求..也可以暴力求~~可以看出最多1022个lucky数..很少... 现将这堆数的所有lucky数找出来...把相同的放在一个lucky数里计数... d…
630C - Lucky Numbers 题目大意: 给定数字位数,且这个数字只能由7和8组成,问有多少种组合的可能性 思路: 假设为1位,只有7和8:两位的时候,除了77,78,87,88之外还哇哦加上前面只有7和8的情况,一共是6位.所以递推式不难写出dp[i]=pow(2,i)+dp[i-1]; 代码: #include <bits/stdc++.h> using namespace std; typedef long long ll; ll ans[56]; void init ()…
Lucky Queries 感觉是很简单的区间合并, 但是好像我写的比较麻烦. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #define PII pair<int, int> #define SZ(x…
题目描述 Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has sequence aa co…
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has an array consisting o…
传送门:https://codeforces.com/contest/110/problem/E 题意:给你一颗树,节点与节点之间的边有一个边权,定义只由4和7组成的数字是幸运数字,现在要你求一共有多少条路径,使得节点u->v之间至少存在一条边为幸运数字 题解:树形dp+容斥,我们要找有多少条路径上至少存在一条幸运边,那么我们就可以找到所有的不含幸运路径的边然后用所有路径和减去不含幸运路径的边即可 1,每次输入边权的时候处理边权是否为幸运数字,如果是,那么为1,否则为0 2,dfs处理,如果边权…
Buy a Ticket 题意:有n个点和m条路(都收费),n个点在开演唱会,门票不同,对于生活在n个点的小伙伴,要求计算出每个小伙伴为了看一场演唱会要花费的最小价格: 思路: 这道题我一开始觉得要对每一个点都跑一次最短路, 然而只用把dis[]的每个点初始化成每个地方的门票价格,在放入优先队列中,接着再跑一遍Dijkstra: 对Dijkstra刷新了认识.至于原理: (可以想明白,每次在队列中找到最小的门票价格去更新(松弛): 注意路费要计算来回: #include <iostream>…
传送门 题意简述:现在有一些号码由000~999中的某些数字组成(会给出),号码总长度为nnn,问有多少个号码满足前n2\frac n22n​个数码的和等于后n2\frac n22n​个数码的和(保证nnn是偶数),答案对998244353998244353998244353取模. 思路: 一道挺显然的生成函数+快速幂. 考虑到前n2\frac n22n​个数码和的生成函数和后n2\frac n22n​个数码和的生成函数是相同的,因此直接求出前n2\frac n22n​个数码和的生成函数,然后对…
LINK 题目大意 很简单自己看 思路 考虑生成函数(为啥tags里面有一个dp啊) 显然,每一个指数上是否有系数是由数集中是否有这个数决定的 有的话就是1没有就是0 然后求出这个生成函数的\(\frac{n}{2}\)次方 把每一项的系数全部平方加起来..没了 #include<bits/stdc++.h> using namespace std; typedef vector<int> Poly; const int N = 3e6 + 10; const int Mod =…
题意:给你一个n,求不大于n的并且仅由两种或者一种数字组成的数的个数.(有点绕,,简单点就是,看看小于等于n点数中,,有多少数字只有一种数字,或者有两种数字组成) “哎,自己还是太菜了,训练的时候只做出来了一个水题,自闭中.....” 思维题刷的太少了,做题的时候总是想不到. 思路呢就是  两个循环,遍历两个数字的组合,然后宝搜就好了: 哎,不说了,说多了都是泪,见代码吧: #include <iostream> #include <cstdio> #include <set…
pro:给定N个点,M条边,现在你要给一些连通块加边,使得至少存在一个连通块的大小是由4和7组成的数字.问至少加边数量. sol: 看似一个很难的题目.  首先不要想太难了,还是应该想能不能用背包做. 我们把块的大小相同的分到一组,就可以分组背包了. 然后注意到组别的大小其实不会太大,因为1*1+2*2+3*3+4*4+x*x<=1e5;   x是1e2级别的. 所以做100次多重背包. 总的复杂度也才O(100*N*K),K是个比较小的常数,真正的复杂度小于这个: #include<bits…
https://codeforc.es/contest/1096/problem/G 把数组分成前后两半,那么前半部分的各个值的表示方案的平方的和就是答案. 这些数组好像可以dp出来. 一开始设dp[i]数组表示1<<i位的各个值,那么做16次NTT然后把n分解下去就求出来答案了.总共要30多次convolution,比较大的NTT少说有6次. 后来发现dp数组可以只记录一次,用完就可以接着用. #include <bits/stdc++.h> using namespace st…
目录 @description@ @solution@ @accepted code@ @details@ @description@ 已知一个数(允许前导零)有 n 位(n 为偶数),并知道组成这个数的数字集合(并不一定要把集合内的数用完).求有多少种可能,使得这个数前半部分的数位和等于后半部分的数位和. 模 998244353. input 第一行两个整数:n k.表示这个数的位数以及组成这个数的数字集合大小.2 <= n <= 2*10^5,1 <= k <= 10. 第二行…
All bus tickets in Berland have their numbers. A number consists of n digits (n is even). Only k decimal digits d1,d2,…,dk can be used to form ticket numbers. If 0 is among these digits, then numbers may have leading zeroes. For example, if n=4 and o…
Lucky Ticket CodeForces - 146A Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not…
1217. Unlucky Tickets Time limit: 1.0 secondMemory limit: 64 MB Strange people live in Moscow! Each time in the bus, getting a ticket with a 6-digit number, they try to sum up the first half of digits and the last half of digits. If these two sums ar…
acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  1024   Calendar Game       简单题  1027   Human Gene Functions   简单题  1037   Gridland            简单题  1052   Algernon s Noxious Emissions 简单题  1409   Commun…
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight Moves1101 Gamblers1204 Additive equations 1221 Risk1230 Legendary Pokemon1249 Pushing Boxes 1364 Machine Schedule1368 BOAT1406 Jungle Roads1411 Annive…
A. Lucky Ticket 题意:就是说4与7是幸运数字,用4和7组成的数字也是幸运数字,问所给数字是不是幸运数字 思路:直接敲 代码: 1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 #include<cstring> 5 #include<algorithm> 6 using namespace std; 7 int main(){ 8 int n; 9 scanf(…
任意门:http://codeforces.com/contest/1058/problem/C C. Vasya and Golden Ticket time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently Vasya found a golden ticket — a sequence which consists…
Lucky ticketsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=86686#problem/J Description Everyone knows that in less than a month the Ice Hockey World Championship will start in Minsk. But few of the…
 2017 JUST Programming Contest 2.0 题目链接:http://codeforces.com/gym/101343/problem/A A. On The Way to Lucky Plaza time limit per test:1.0 s memory limit per test:256 MB input:standard input output:standard output Alaa is on her last day in Singapore, s…
题目链接:http://www.codeforces.com/problemset/problem/122/A题意:判断一个数是否能被一个lucky number整除,一个lucky number是一个只包含4或7的数.C++代码: #include <cstdio> ] = {, , , , , , , , , , , , , }; bool check(int x) { ; i < ; i ++) ) return true; return false; } int main() {…
链接: https://codeforces.com/contest/1215/problem/D 题意: Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have bee…
C. Vasya and Golden Ticket time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Recently Vasya found a golden ticket - a sequence which consists of n digits a1a2-an. Vasya considers a ticket to be l…
Codeforces 1215D Ticket Game 原题 题目 Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The numbe…