04 2018 档案

摘要:Queue and A#includeusing namespace std;const int maxn = 1000 + 5;struct topic{ int n,st,t,b,w = 0;}t;struct person{ int w = 0,st... 阅读全文
posted @ 2018-04-30 23:50 ACLJW 阅读(162) 评论(0) 推荐(0)
摘要:Do You Know the Way to San Jose?题目不难,主要就是排序,不过有些细节需要注意。一个很坑的地方是 map 的两个对角点是不确定的,可能是左上和右下,也可能是左下和右上,而且两个点的顺序也不一定是左右。。。害我找了好久的bug。。。还有就是... 阅读全文
posted @ 2018-04-29 23:44 ACLJW 阅读(186) 评论(0) 推荐(0)
摘要:Searching the Web这道题就 "and" 查询麻烦点,别的还好,但是刚开始超时了。。。version 1(Time limit exceeded):#includeusing namespace std;const int maxn = 100 + 5;... 阅读全文
posted @ 2018-04-28 21:42 ACLJW 阅读(229) 评论(0) 推荐(0)
摘要:Bug Hunt我的思路:对于每行code,若无等号,直接初始化数组即可,否则依次检查等号左边和右边的表达式是否正确。对于左边的表达式,只需检查到首个数组之前即可,因为可能要对其初始化;对于右边表达式则要全部检查。对于复合表达式要如何检查呢?我的做法是先找出数字下标,... 阅读全文
posted @ 2018-04-25 12:24 ACLJW 阅读(285) 评论(0) 推荐(0)
摘要:Borrowers又因为输出WA了一发。。。一定要看清楚输出要求啊啊#include#include#include#include#include#includeusing namespace std;const int maxn = 10000;typedef p... 阅读全文
posted @ 2018-04-23 10:48 ACLJW 阅读(186) 评论(0) 推荐(0)
摘要:Compound Words我的思路:对于每个单词,依次枚举其所有可能组合的情况,看其两个子单词是否存在于dict中。version 1(30ms):#include#include#include#includeusing namespace std;int mai... 阅读全文
posted @ 2018-04-22 21:18 ACLJW 阅读(209) 评论(0) 推荐(0)
摘要:Updating a Dictionaryversion 1:#include#include#include#include#includeusing namespace std;const int maxl = 100 + 5;int t,n;char c;voi... 阅读全文
posted @ 2018-04-22 16:56 ACLJW 阅读(207) 评论(0) 推荐(0)
摘要:Printer Queuepriority_queue + queue#include#includeusing namespace std;const int maxn = 500000;int t,n,pos;int main(){ scanf("%d",&... 阅读全文
posted @ 2018-04-22 16:52 ACLJW 阅读(178) 评论(0) 推荐(0)
摘要:Symmetry我的思路:开始是想着将所有点都存在set里面,找出对称轴,然后对于每一个点确定其对称点是否存在,但是觉得这样效率似乎太低,就放弃了。后来想到了这样做:将所有点按x坐标进行排序,若x坐标相同,则对于对称轴左边的点按y坐标又小到大排序,右边则相反。这样的话... 阅读全文
posted @ 2018-04-22 15:42 ACLJW 阅读(167) 评论(0) 推荐(0)
摘要:Foreign Exchangeversion 1(100ms):#include#include#includeusing namespace std;int n;int main(){ while(scanf("%d",&n) && n){ m... 阅读全文
posted @ 2018-04-21 22:52 ACLJW 阅读(159) 评论(0) 推荐(0)
摘要:Throwing cards away I queue#include#includeusing namespace std;int n;int main(){ while(scanf("%d",&n) && n){ if(n == 1){ //注... 阅读全文
posted @ 2018-04-21 22:45 ACLJW 阅读(146) 评论(0) 推荐(0)
摘要:Ducci Sequenceversion 1(130ms):#includeusing namespace std;const int maxn = 20;int t,n,a[maxn];int main(){ scanf("%d",&t); while... 阅读全文
posted @ 2018-04-21 22:05 ACLJW 阅读(161) 评论(0) 推荐(0)
摘要:Alignment of Code#include#include#include#include#includeusing namespace std;const int maxw = 180 + 5;const int maxl = 1000 + 5;int sp... 阅读全文
posted @ 2018-04-21 01:14 ACLJW 阅读(120) 评论(0) 推荐(0)
摘要:The Letter Carrier's Rounds注意可能有重复的收件人。version 1(20ms):#include#include#include#include#include#includeusing namespace std;const int m... 阅读全文
posted @ 2018-04-20 17:10 ACLJW 阅读(112) 评论(0) 推荐(0)
摘要:PGA Tour Prize Money 这道题太麻烦了,先放这儿,日后再说。。。#include#include#includeusing namespace std;const int maxn = 150;struct player{ char name[... 阅读全文
posted @ 2018-04-19 19:18 ACLJW 阅读(225) 评论(0) 推荐(0)
摘要:Urban Elevations书上的思路(离散化):把所有x坐标排序去重,则任意两个相邻x坐标形成的区间具有相同属性,一个区间要么完全可见,要么完全不可见。这样,只需在这个区间里任选一个点(例如中点),就能判断出一个建筑物是否在整个区间内可见。如何判断一个建筑物是否... 阅读全文
posted @ 2018-04-18 23:18 ACLJW 阅读(166) 评论(0) 推荐(0)
摘要:Database思路:只枚举c1和c2,然后从上到下扫描各行。每次碰到一个新的行r,把c1,c2两列的内容作为一个二元组存到一个map中。如果map的键值中已经存在这个二元组,该二元组映射到的就是所要求的r1,而当前行就是r2。在主循环之前先做一个预处理——给所有字符... 阅读全文
posted @ 2018-04-18 00:00 ACLJW 阅读(167) 评论(0) 推荐(0)
摘要:Unix ls #include#include#includeusing namespace std;const int len = 60 + 2;void print(const string& s,int len,char extra){ cout>n){... 阅读全文
posted @ 2018-04-17 21:21 ACLJW 阅读(135) 评论(0) 推荐(0)
摘要:Ugly Numbers从小到大生成各个丑数,最小的丑数是1,而对于任意丑数x,2x、3x和5x也都是丑数。这样,就可以用一个优先队列保存所有已生成的丑数,每次取出最小的丑数,生成3个新的丑数。唯一需要注意的是,同一个丑数有多种生成方式,所以需要判断一个丑数是否已经生... 阅读全文
posted @ 2018-04-17 12:39 ACLJW 阅读(105) 评论(0) 推荐(0)
摘要:Team Queue本题有两个队列:每个团队有一个队列,而团队整体又形成一个队列,建两个queue即可。#include#include#includeusing namespace std;const int maxt = 1000 + 5;int t,n;char... 阅读全文
posted @ 2018-04-16 23:58 ACLJW 阅读(150) 评论(0) 推荐(0)
摘要:The SetStack Computer为每个不同的集合分配一个唯一的ID,则每个集合都可以表示成所包含元素的ID集合,这样就可以用STL的set来表示了,而整个栈则是一个stack。#include#include#include#include#include#... 阅读全文
posted @ 2018-04-16 21:46 ACLJW 阅读(174) 评论(0) 推荐(0)
摘要:Ananagrams思路:对于每一个单词,先存入数组,然后标准化(小写加排序)后的单词的计数值加1,最后输出数组中计数位1的单词即可。version 1(自己写的版本):#include#include#include#includeusing namespace s... 阅读全文
posted @ 2018-04-15 21:57 ACLJW 阅读(98) 评论(0) 推荐(0)
摘要:Andy's First Dictionary#include#include#include#includeusing namespace std;setdict;int main(){ string s,buf; while(cin >> s){ ... 阅读全文
posted @ 2018-04-15 20:49 ACLJW 阅读(155) 评论(0) 推荐(0)
摘要:The Blocks Problem其实四条命令可以简化为两个操作:1. 把某个块上面的块放回原位;2. 把某个块及其上的块放到另一个块所在的堆顶。还可以加一个数组保存每个块的所在的堆,这样写出来的代码比书上还间接哈哈哈。第一次WA是多输出了换行,第二次是以为有多组数... 阅读全文
posted @ 2018-04-15 17:11 ACLJW 阅读(128) 评论(0) 推荐(0)
摘要:Where is the Marble?排序加二分查找#include#includeusing namespace std;const int maxn = 100000;int n,q,mar[maxn];int main(){ int kase = 0; ... 阅读全文
posted @ 2018-04-15 13:19 ACLJW 阅读(193) 评论(0) 推荐(0)
摘要:Flooded!思路:题目中说了不需要考虑几个坑是分开的那种情况,所以可以将所有的方格由低到高排序排序,从最低的方格开始灌水,如果可以淹没它,增加淹没面积、海拔高度和淹没个数,减少体积,再接着看下一个方格,否则计算终高度然后 break 即可。刚开始 WA 了,我还以... 阅读全文
posted @ 2018-04-14 22:10 ACLJW 阅读(152) 评论(0) 推荐(0)
摘要:RAID! version 1:#include#includeusing namespace std;const int maxd = 10,maxs = 64,maxb = 105;int c,p,d,s,b;char data[maxd][maxs*maxb],... 阅读全文
posted @ 2018-04-14 08:38 ACLJW 阅读(96) 评论(0) 推荐(0)
摘要:Squaresversion 1(20ms):#include#includeusing namespace std;const int maxn = 10;int n,m,c,H[maxn][maxn],V[maxn][maxn];char readchar(){ ... 阅读全文
posted @ 2018-04-13 19:40 ACLJW 阅读(175) 评论(0) 推荐(0)
摘要:Othello我的这道题的代码还是比较简洁的哈哈。version 1:#include#includeusing namespace std;int n,wn,bn;int dxs[3] = {0,1,-1};int dys[3] = {0,1,-1};char c,... 阅读全文
posted @ 2018-04-13 13:30 ACLJW 阅读(189) 评论(0) 推荐(0)
摘要:IP Networks注意单个IP地址及网络地址后面加 .0 的情况(cnt #includeusing namespace std;const int maxn = 1000 + 5;int n,num[maxn][4];int main(){ while(s... 阅读全文
posted @ 2018-04-12 21:56 ACLJW 阅读(161) 评论(0) 推荐(0)
摘要:253:Cube painting开始的想法:骰子无论怎么转,每个数字和其对面的数字的对应关系永远不会改变,所以只需要比较两个骰子的三对数字是否相同即可,也的确AC了,但是后来想想不太对。#include#includeusing namespace std;char... 阅读全文
posted @ 2018-04-12 12:43 ACLJW 阅读(156) 评论(0) 推荐(0)
摘要:和 0 - 1 背包的区别是每种物品可以选任意多个。dp[i+1][j] = 从前 i 种物品中挑选总重量不超过 j 时总重量的最大值。递推关系为:dp[0][j] = 0dp[i+1][j] = max{ dp[i][j - k*w[i]] + k*v[i] | ... 阅读全文
posted @ 2018-04-11 23:25 ACLJW 阅读(107) 评论(0) 推荐(0)
摘要:UVa - 512 Spreadsheet Tracking思路1:首先模拟操作,算出最后的电子表格,然后在每次查询时直接在电子表格中找到所求的单元格。#include#includeusing namespace std;const int maxn = 100,b... 阅读全文
posted @ 2018-04-11 20:42 ACLJW 阅读(195) 评论(0) 推荐(0)
摘要:Some message encoding schemes require that an encoded message be sent in two parts. The first part, called the header, contains the ch... 阅读全文
posted @ 2018-04-11 10:18 ACLJW 阅读(212) 评论(0) 推荐(0)
摘要:The Dole Queue Time limit: 3.000 secondsIn a serious attempt to downsize (reduce) the dole queue, The New National Green Labour Rhinoc... 阅读全文
posted @ 2018-04-10 13:10 ACLJW 阅读(119) 评论(0) 推荐(0)
摘要:489 - Hangman JudgeTime limit: 3.000 secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show... 阅读全文
posted @ 2018-04-09 17:32 ACLJW 阅读(137) 评论(0) 推荐(0)
摘要:Ancient CipherTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 36467 Accepted: 11879DescriptionAncient Roman empire had a str... 阅读全文
posted @ 2018-04-09 10:50 ACLJW 阅读(154) 评论(0) 推荐(0)
摘要:Cash MachineTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 38756 Accepted: 14102DescriptionA Bank plans to install a machin... 阅读全文
posted @ 2018-04-07 00:53 ACLJW 阅读(364) 评论(0) 推荐(0)
摘要:KickdownTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 2214 Accepted: 944DescriptionA research laboratory of a world-leadin... 阅读全文
posted @ 2018-04-06 22:51 ACLJW 阅读(183) 评论(0) 推荐(0)
摘要:BoxTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4196 Accepted: 1518DescriptionIvan works at a factory that produces heavy... 阅读全文
posted @ 2018-04-06 20:16 ACLJW 阅读(114) 评论(0) 推荐(0)
摘要:All in AllTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 34909 Accepted: 14571DescriptionYou have devised a new encryption ... 阅读全文
posted @ 2018-04-06 18:31 ACLJW 阅读(145) 评论(0) 推荐(0)
摘要:The decimal expansion of the fraction 1/33 is 0.03, where the 03 is used to indicate that the cycle 03repeats indefinitely with no int... 阅读全文
posted @ 2018-04-06 09:45 ACLJW 阅读(165) 评论(0) 推荐(0)
摘要:问题简述:给定m个长度为n的DNA序列,求一个DNA序列,使其到所有这些序列的总hamming距离尽量小,如果有多个解,输出字典顺序的最小解。贪心#include#includeusing namespace std;const int maxn = 1000 + 5... 阅读全文
posted @ 2018-04-05 18:15 ACLJW 阅读(178) 评论(0) 推荐(0)
摘要:Crossword AnswersTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1357 Accepted: 572DescriptionA crossword puzzle consists of... 阅读全文
posted @ 2018-04-05 17:39 ACLJW 阅读(215) 评论(0) 推荐(0)
摘要:A children’s puzzle that was popular 30 years ago consisted of a 5×5 frame which contained 24 smallsquares of equal size. A unique let... 阅读全文
posted @ 2018-04-05 13:18 ACLJW 阅读(258) 评论(0) 推荐(0)
摘要:A character string is said to have period k if it can be formed by concatenating one or more repetitionsof another string of length k.... 阅读全文
posted @ 2018-04-05 00:20 ACLJW 阅读(283) 评论(0) 推荐(0)
摘要:Trung is bored with his mathematics homeworks. He takes a piece of chalk and starts writing a sequenceof consecutive integers starting... 阅读全文
posted @ 2018-04-04 22:50 ACLJW 阅读(192) 评论(0) 推荐(0)
摘要:An organic compound is any member of a large class of chemicalcompounds whose molecules contain carbon. The molarmass of an organic co... 阅读全文
posted @ 2018-04-04 22:11 ACLJW 阅读(164) 评论(0) 推荐(0)
摘要:There is an objective test result such as “OOXXOXXOOO”. An ‘O’ means a correct answer of a problemand an ‘X’ means a wrong answer. The... 阅读全文
posted @ 2018-04-04 21:47 ACLJW 阅读(185) 评论(0) 推荐(0)
摘要:Some DNA sequences exist in circular forms as in the following figure, which shows a circular sequence “CGAGTCAGCT”, that is, the la... 阅读全文
posted @ 2018-04-04 13:03 ACLJW 阅读(205) 评论(0) 推荐(0)
摘要:For a positive integer N, the digit-sum of N is defined as the sum of N itself and its digits. When M is the digitsum of N, we call N... 阅读全文
posted @ 2018-04-04 11:44 ACLJW 阅读(229) 评论(0) 推荐(0)
摘要:MasterMind is a game for two players. One of them, Designer, selects a secret code. The other, Breaker, tries to break it. A code is n... 阅读全文
posted @ 2018-04-04 08:45 ACLJW 阅读(119) 评论(0) 推荐(0)
摘要:PalindromesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1253 Accepted Su... 阅读全文
posted @ 2018-04-03 23:18 ACLJW 阅读(157) 评论(0) 推荐(0)
摘要:WERTYUTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9533 Accepted: 4543Description A common typing error is to place the h... 阅读全文
posted @ 2018-04-03 23:16 ACLJW 阅读(190) 评论(0) 推荐(0)
摘要:TEX QuotesTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 10913 Accepted: 5670DescriptionTEX is a typesetting language devel... 阅读全文
posted @ 2018-04-03 23:00 ACLJW 阅读(124) 评论(0) 推荐(0)
摘要:总时间限制: 1000ms内存限制: 1024kB描述有一种特殊的二进制密码锁,由n个相连的按钮组成(n#includeusing namespace std;const int maxn = 30;int n;int getBit(int n,int i){ ... 阅读全文
posted @ 2018-04-02 23:34 ACLJW 阅读(378) 评论(0) 推荐(0)
摘要:EXTENDED LIGHTS OUTTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 12788 Accepted: 8097DescriptionIn an extended version of ... 阅读全文
posted @ 2018-04-02 21:50 ACLJW 阅读(192) 评论(0) 推荐(0)
摘要:Common SubsequenceTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 58057 Accepted: 24243DescriptionA subsequence of a given s... 阅读全文
posted @ 2018-04-01 11:05 ACLJW 阅读(154) 评论(0) 推荐(0)