uvalive 2965 Jurassic Remains】的更多相关文章

Jurassic Remains Time Limit: 18000MS   Memory Limit: Unknown   64bit IO Format: %lld & %llu [Submit]   [Go Back]   [Status] Description   Paleontologists in Siberia have recently found a number of fragments of Jurassic period dinosaur skeleton. The p…
https://vjudge.net/problem/UVALive-2965 题意: 给出若干个由大写字母组成的字符串,要求选出尽量多的字符串,使得每个大写字母出现的次数是偶数. 思路: 如果说我们把每个字母映射为不同的数字,那么每个字符串就可以用不同的数字来表示,即按照二进制位转化各个字符. 如ABCD既可以表示为1111,ABCE可以表示为11101. 那么问题就转化成了给出n个数字,那么选择尽量多的数字使得他们的异或为0(每个字符出现偶数次,则他们的异或肯定为0). 一开始我直接用的2^…
题意:给定 n 个大写字母组成的字符串,选择尽量多的串,使得大写字母都能出现偶数次. 析:由于n比较小,我们可以枚举前n/2的所有组合,然后再从后面查找. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include…
Jurassic Remains Paleontologists in Siberia have recently found a number of fragments of Jurassic period dinosaur skeleton. The paleontologists have decided to forward them to the paleontology museum. Unfortunately, the dinosaur was so huge, that the…
题目 传送门:QWQ 分析 太喵了~~~~~ 还有中途相遇法这种东西的. 嗯 以后可以优化一些暴力 详情左转蓝书P58 (但可能我OI生涯中都遇不到正解是这个的题把...... 代码 #include <bits/stdc++.h> using namespace std; ; map<int,int> table; ?:bitcount(x>>)+(x&);} int main(){ int n,A[maxn]; ]; && n){ ;i<…
这是我做的第一道状态压缩的题目,而且我自己居然看懂了,理解得还算透彻. 题意:给出若干个大写字母组成的字符串,然后选取尽量多的字符串使得这些字母出现偶数次. 最朴素的想法,穷举法:每个字符串只有选和不选两种情况,那么穷举的时间复杂度是O(2n) 优化:将这n个字符串分成两半,先后枚举前n1个字符串所有可能的情况,计算xor值并保存在table中 再枚举后半部分的xor值并在table中查找(因为如果两者的异或值相同,则进行异或运算后的值为0),如果找到,将ans更新为bitcount较大的那种方…
题目 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=966 题意 n个大写字母串(n <= 24),问最多取多少个,使得所有字符出现的次数都是偶数. 思路 如刘书 1. 由于最多出现26个字母,而且字母在字符串中出现的次数本身不重要,只要记录奇偶性,所以可以将这些字符串转化为01串便于存储. 2. 问题转化为最多取多少…
例题25  侏罗纪(Jurassic Remains, NEERC 2003, LA 2965) 给定n个大写字母组成的字符串.选择尽量多的串,使得每个大写字母都能出现偶数次. [输入格式] 输入包含多组数据.每组数据的第一行为正整数n(1≤n≤24),以下n行每行包含一个大写字母组成的字符串. [输出格式] 对于每组数据,第一行输出整数k,即字符串个数的最大值.第二行按照从小到大的顺序输出选中的k个字符串的编号(字符串按照输入顺序编号为1~n). [样例输入] 6 ABD EG GE ABE…
Jurassic Remains https://vjudge.net/problem/UVALive-2965 Paleontologists in Siberia have recently found a number of fragments of Jurassic period dinosaur skeleton. The paleontologists have decided to forward them to the paleontology museum. Unfortuna…
题意:给定n个只有大写字母组成的字符串,选取尽可能多的字符串,使得这些字符串中每个字母的个数都是偶数.n<=24 思路:直接枚举每个字符串的选或不选,复杂度是O(2^n).其实还有更简便的方法. 对于每个字母,其实具体出现了多少次并不重要,重要的是奇数次还是偶数次,我们用0对应奇数次,1对应偶数次.对于每个字符串,我们就可以计算出对应的二进制数,方法如下.如果A出现奇数次,那么二进制数第一个位置为1,偶数次为0:如果B出现奇数次,那么二进制数第二个位置为1,偶数次为0……以此类推,每个位置都有一…
题解 在一个字符串中,每个字符出现的次数本身是无关紧要的,重要的只是这些次数的奇偶性,因此想到用一个二进制的位表示一个字母($1$表示出现奇数次,$0$表示出现偶数次).比如样例的$6$个数,写成二进制后如图所示. 此时,问题转化为求尽量多的数,使得它们的$xor$值为$0$. 最容易想到的方法是直接穷举,时间复杂度为$O(2^n)$,有些偏大.注意到$xor$值为$0$的两个整数必须完全相等,我们可以把字符串分成两个部分:首先计算前$n \over 2$个字符串所能得到的所有$xor$值,并将…
题意 题意给定n个大写字母组成的字符串,选择尽量多的串,使得每个大写字母都能出现偶数次.n<=24,每个字符串中每个字母最多出现一次. 分析 这是训练指南上的一道中途相遇法的简单题,但是好像也能爆过去?? 我们还是按照惯用的套路,把n个字符串分为两部分,第一部分有n/2个字符串,另一部分有n-n/2个字符串 我们发现每个字母出现了几次不重要,重要的是这个字母出现的次数是奇还是偶,所以每个字母的奇偶可以用二进制的串来表示. 然后枚举第一部分的字符串,对于每种选择的方法(这个枚举也可以用二进制枚举)…
训练指南p.59 #include <cstdio> #include <cstring> #include <cstdlib> #include <map> using namespace std; ; int N; int A[MAXN]; ]; map<int , int> table; int bitcount( int x ) { ; while ( x ) { ) ++res; x >>= ; } return res;…
poj1010--邮票问题 DFSpoj1011--Sticks dfs + 剪枝poj1020--拼蛋糕poj1054--The Troublesome Frogpoj1062--昂贵的聘礼poj1077--Eightpoj1084--Square Destroyerpoj1085--Triangle War(博弈,極大極小搜索+alpha_beta剪枝)poj1088--滑雪poj1129--Channel Allocation 着色问题 dfspoj1154--letters (dfs)p…
UVA 1394 And Then There Was One / Gym 101415A And Then There Was One / UVAlive 3882 And Then There Was One / POJ 3517 And Then There Was One / Aizu 1275 And Then There Was One (动态规划,思维题) Description Let's play a stone removing game. Initially, n ston…
B - Nubulsa Expo Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice UVALive 5099 Description   You may not hear about Nubulsa, an island country on the Pacific Ocean. Nubulsa is an undeveloped country and it…
B - Nubulsa Expo Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice UVALive 5099 Description You may not hear about Nubulsa, an island country on the Pacific Ocean. Nubulsa is an undeveloped country and it i…
One-way traffic Time Limit: 3000ms Memory Limit: 131072KB This problem will be judged on UVALive. Original ID: 266464-bit integer IO format: %lld      Java class name: Main   In a certain town there are n intersections connected by two- and one-way s…
The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286   Accepted: 8603   Special Judge Description The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a…
出现在rename一个目录时,再提交时一直报错 Aborting commit: remains in conflict 使用右键菜单 svn - resolve 即可解决.用cleanup之类的都没用的,删了重新下载都不行 操作时记得备份已修改的文件或目录. svn resolved: 移除工作副本的目录或文件的"冲突"状态. 用法: resolved PATH- 注意: 本子命令不会依语法来解决冲突或是移除冲突标记:它只是移除冲突的相关文件,然后让 PATH 可以再次提交.…
先列出题目: 1.POJ 1753 POJ 1753  Flip Game:http://poj.org/problem?id=1753 Sample Input bwwb bbwb bwwb bwww Sample Output 4 入手竟然没有思路,感觉有很多很多种情况需要考虑,也只能使用枚举方法才能解决了吧~ 4x4的数组来进行数据存储的话操作起来肯定非常不方便,这里借用位压缩的方法来存储状态,使用移位来标识每一个位置的的上下左右的位置操作. 详细看这里. 1.当棋盘状态id为0(全白)或…
UVALive - 4108 SKYLINE Time Limit: 3000MS     64bit IO Format: %lld & %llu Submit Status uDebug Description   The skyline of Singapore as viewed from the Marina Promenade (shown on the left) is one of the iconic scenes of Singapore. Country X would a…
UVALive - 3942 Remember the Word A potentiometer, or potmeter for short, is an electronic device with a variable electric resistance. It has two terminals and some kind of control mechanism (often a dial, a wheel or a slide) with which the resistance…
UVALive - 3942 Remember the Word Neal is very curious about combinatorial problems, and now here comes a problem about words. Know- ing that Ray has a photographic memory and this may not trouble him, Neal gives it to Jiejie. Since Jiejie can’t remem…
svn 提交报错 提交命令: svn update 提示代码: Skipped 'ApiController.php' -- Node remains in conflict At revision . Summary of conflicts: Skipped paths: 解决方法: svn remove --force ApiController.php svn resolve --accept=working ApiController.php svn update 提交成功! Upda…
http://stackoverflow.com/questions/11774868/svn-checkout-without-restoring up vote4down votefavorite 2 We have some company middleware and sometimes its difficult to find the correct version Im looking for so I often have to update to different versi…
static void Main(string[] args) { var eng = new Jurassic.ScriptEngine(); eng.Evaluate("function text(){return 10;}"); int rs= eng.CallGlobalFunction<int>("text"); Console.WriteLine(rs); Console.Read(); } 插件下载地址 https://jurassic.c…
测试类 public class Script_Common { public string read(string filename) { return System.IO.File.ReadAllText(filename); } public void log(object obj) { Console.WriteLine(obj.GetType() + " - " + obj); } public void demo(params object[] items) { log(s…
Aborting commit: 'XXX' remains in conflict 错误   本地也删除了一个文件夹,用svn 的repo-brower 删除了服务器上的对应的文件夹 ,再次commit的时候,出现错误:Aborting commit: 'XXX' remains in conflict 错误   解决方法: 右键项目目录-->选择TortoiseSVN->Revert,在窗口中选择已经删除的文件夹,点击确定,就解决了这个问题.…
Sackler Museum of Art and Archaeology at Peking University is located on a beautiful site near the West Gate of Peking University campus, and its architecture takes the inspiration from buildings that already exist on campus. The collection of Chines…