ZOJ 3954 Seven-Segment Display】的更多相关文章

Seven Segment Display Time Limit: Seconds Memory Limit: KB A seven segment display, or seven segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix displays. Sev…
Seven Segment Display 思路: 经典数位dp 代码: #include<bits/stdc++.h> using namespace std; #define LL long long #define pb push_back #define mem(a,b) memset(a,b,sizeof(a)) ]={,,,,,,,,,,,,,,,}; ]; LL dp[][]; LL dfs(int pos,int sum,bool limit){ )return sum; if…
非常好的一个题,可以比赛时想到的状态太奇葩,不方便转移,就一直没能AC. 思路:dp(i, j)表示已经考虑了前i位,前i位的和为j的贡献.如果当前的选择一直是最大的选择,那么就必须从0~下一位的最大值之间选择,所以必须增加一个标记表示当前是否被限制.否则就可以从0~15中任选一个填充该位,这种情况就是可能被重复访问的,因为要填充剩下的位,每一位都能填0~15,所以记忆一下,当再次访问时就返回. AC代码 #include <cstdio> #include <cmath> #in…
题意:给一个16进制8位数,给定每个数字的贡献,问你贡献和. 思路:数位DP,想了很久用什么表示状态,看题解说用和就行,其他的都算是比较正常的数位DP. 代码: #include<iostream> #include<stdio.h> #include<cmath> #include<string> #include<queue> #include<set> #include<vector> #include<str…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3962 题目大意: 有t组数据. 给你一个n,和8位的十六进制数st,还有一张表格,里面有每一个数字的消耗. 比如"5A8BEF67"的消耗为为5 + 6 + 7 + 5 + 5 + 4 + 6 + 3 = 41. 然后让你求[n,n+st-1]区间的所有的数字的消耗之和. 解题思路: 数位DP,用solve(x)求0~x的总消耗. lim=0xFFFF…
地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3962 题目: A seven segment display, or seven segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix…
Seven Segment Display Time Limit: 1 Second      Memory Limit: 65536 KB A seven segment display, or seven segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix d…
Seven Segment Display Time Limit: 2 Seconds      Memory Limit: 65536 KB A seven segment display, or seven segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix…
传送门:Seven Segment Display 题意:求一个给定区间每个数字的消耗值的和: 思路:数位DP,有点区间和的思想,还有就是这个十六进制,可以用%llx读,还是比较难的: 还有就是到最大的 0xffffffff 后,会从新跳到0,这里要加上两段solve(ri)+solve(most)-solve(m-1): #include <iostream> #include <cstdio> #include <cstring> #include <algo…
题目链接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3954 题意 有一块 LED 灯 然后上面有七块灯管 在显示不同数字的时候 由灯管的开关组合 来表现一个数字 给出一个标准表 然后 输入 一个表 求这个表 的 列 是可以交换的 然后 判断能否有一种经过若干次交换后的情况 这个表能够跟 标准表 相同 如果能 就输出 YES 不能 就输出 NO 思路 我们可以用MAP 存下 标准表的列 和 输入的表 的列 然后判断一…