”sicily“ 的搜索结果

     Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One day, while working on his latest project, he was in

     二分答案 题意: 有n种珍珠,每种珍珠i有ai颗. 一条链子由m颗不同种的珍珠组成. 给出n,m,数组a.问最多能合成多少条链子 数据范围: n 思路: 暴力的方法也不简单啊.这里的珍珠优先度是先用数量最多的m颗...

     1344. 数列 Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description 给定一个正整数k(3≤k≤15),把所有k的方幂及所有有限个互不相等的k的方幂之和构成一个递增的序列,例如,当k=3时,这个序列是...

Sicily 1194

标签:   sicily

     题目: Input There are multiple test cases. In each case, at the first line there are two numbers n and m (1, m), which is the number of friends and the number of messages he has received

Sicily 1753. 解码

标签:   Sicily  C++

     Time Limit: 1 secs, Memory Limit: 32 MBDescriptionZX是另一头04级的牛,他现在在UPen。他跟LLK经常通信,但他不喜欢直接把信息发给LLK,而是把信息通过一个规则转换后再发给LLK,这让LLK很郁闷。...

     1028. Hanoi Tower Sequence Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description ...Hanoi Tower is a famous game invented by the French mathematician Edourard Lucas in 1883....

     1323. Switch text Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description The program must switch the text lines in a backward order and split them by the middle, processing the input l

     1930. 排序 Description 我们都知道,在排序算法中需要进行多次比较。若比较的两个数Ai, Aj(iAj的话,则称作有效比较。给定一个有N个互异元素的整数序列,请使用选择排序对序列进行排序,并输出其有效比较...

Sicily 1035

标签:   sicily

     // Copyright [2014] // Sicily 1035 #include #include using namespace std; bool suit_letter(char a, char b) { if ((a == 'T' && b == 'A')||(a == 'A' && b == 'T')) return true; else

     简要思路:利用栈存储括号(分小括号,中括号,大括号),如果是左括号就push进栈;如果是右括号且top是相应的左括号,就pop了。到最后遍历完整个字符串,如果这个栈是空的,说明所有的括号都匹配了。...

     Description The columnar encryption scheme scrambles the letters in a message (or plaintext) using a keyword as illustrated in the following example: Suppose BATBOY is the keyword and our message i

     9017. Amazing Mazes Constraints Time Limit: 1 secs, Memory Limit: 256 MB Description You are requested to solve maze problems. Without passing through these mazes, you...

Sicily 1200 stick

标签:   sicily

     意思大概就是说有n个数(n为奇数),数值相同的两个数可以成为一对,然后删除,求最终剩余的那个数,输入是合法的,比如输入为1, 2 1 则输出应该为 2。 给我的第一直觉就是先排序,然后遍历一遍,找到那个数,采用的...

     #include<iostream> #include<memory.h> using namespace std; bool a[200];//标记是否走过 int b[200][200]; int n,m; bool flag; void dfs(int start,int count) { ... ...

     题目描述定义超级和函数F如下: F(0, n) = n,对于所有的正整数n.. F(k, n) = F(k – 1, 1) + F(k – 1, 2) + … + F(k – 1, n),对于所有的正整数k和n. 请实现下面Solution类中计算F(k, n)的函数(1 , n )

     这里要注意到,有n个点,但是只有n-1条路径,说明是树,用dfs求树的最长路径: (用c++输入0.35s,用c输入0.18s)#include <iostream> #include <vector> #include <string.h> #include <cstring> ...

     错误写法:贪心算法 •先对N个字符串按字典序排序 •后从小到大拼在一起 •如:a ac ab 排序后就是 a ab ac •最后的字符串即是 aabac ...•又如:b ac bd abc 排序后是 abc ac b bd ...#include "iost

     #include #include #include #include #include using namespace std; int main(){ int n; while(cin>>n && n){ bool visit[20]; //判断是否已经访问过 string ID[20]; string IP[20];...m

     水题,简单模拟。 // Problem#: 1093 // Submission#: 2250427 // The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License // URI: ...

     分析典型的0/1背包问题,注意初始化,注意if的判断,只要找到dp公式就行,dp[N][k] = max{dp[N][k-1], dp[N-v[k]][k-1]+v[k]*p[k]} dp为买N元前k件的最大价值。题解#include using namespace std;...

     1144. 陶陶摘苹果 Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description 陶陶家的院子里有一棵苹果树,每到秋天树上就会结出10个苹果。苹果成熟的时候,陶陶就会跑去摘苹果。陶陶有个30厘米高的板凳,...

     大意就是求出两个地点的最短路。 简单的单源最短路问题,我用的是优先队列实现的dijkstra算法,离散数学教的~注意题目的陷阱,输入数据的坑就好啦。 #include #include #include #include ...

sicily1198

标签:   sicily  recursion  string

     1198. Substring Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description Dr lee cuts a string S into N pieces,s[1],…,s[N]....Now, Dr lee gives you these N sub-strings: s[1],…s[N]....

     sicily_1935_重建二叉树解题报告 传送门:http://soj.sysu.edu.cn/1935 主要的思路是我已经得到先序遍历序列和中序遍历序列,如何将这个树分成三部分:根,左子树,右子树。而区分的之后,先把根插入树中,再左...

     题目见:http://soj.sysu.edu.cn/7151 乍一看是搜索,其实仔细看完后就会发现是模拟。 针对不同“智商”,分情况处理即可,对每读入的字符都进行移动。...void find_position(char dir, int power, char na[]);...

10  
9  
8  
7  
6  
5  
4  
3  
2  
1