- 博客(140)
- 收藏
- 关注
原创 1114. Family Property (25)
This time, you are supposed to help us collect the data for family-owned property. Given each person's family members, and the estate(房产)info under his/her own name, we need to know the size of each f
2017-02-20 15:50:15 297
原创 1119. Pre- and Post-order Traversals (30)
Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal sequences, or preorder and inorder
2016-11-03 15:12:11 1593
原创 1118. Birds in Forest (25)
Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belong to the same tree. You are supposed to help the scientists to count the maxi
2016-11-03 15:04:09 232
原创 1117. Eddington Number(25)
British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number", E -- that is, the maximum integer E such that it is for E
2016-11-03 15:03:29 233
原创 1116. Come on! Let's C (20)
时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, Yue"Let's C" is a popular and fun programming contest hosted by the College of
2016-11-03 15:02:00 223
原创 1022. Digital Library (30)
A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number a
2016-08-26 00:36:32 239
原创 10129 - Play on Words
单词是边,两端字母是节点,图有没有欧拉回路。判断图的连通性和各节点的度#include #include #include #include using namespace std;const int maxn = 30;int uset[26],used[26];int degree[maxn];void usetinit(){for(int i=0;i<26;i++)uset[
2016-08-16 14:18:55 244
原创 1111. Online Map (30)
Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is the shortest, and the other is the fastest. It is g
2016-08-13 14:37:38 710
原创 1110. Complete Binary Tree (25)
Given a tree, you are supposed to tell if it is a complete binary tree.Input Specification:Each input file contains one test case. For each case, the first line gives a positive integer N (<=2
2016-08-09 19:32:11 295
原创 1596 - Bug Hunt
用map > Mem 类型模拟内存,数组名对应的索引的值用map Size 来存放数组对应的大小假设只有未初始化和越界的错误。即对每个表达式进行扫描,从里到外依次检验每个数组是否越界,是否未初始化。如果只有数组,则最外面的数组是声明,如果是赋值表达式,那么就不是声明。每次到声明就把数组名和对应的大小记下来。#include #include #include #include
2016-08-06 14:20:36 394
原创 230 - Borrowers
不一定真的插入删除才能完成模拟过程。#include #include #include #include #include using namespace std;struct book{ string name,author; int tag; book(const string & n ="n",const string & a="a",int t = 1):name(n)
2016-08-05 17:23:12 260
原创 156 - Ananagrams
#include #include #include #include #include using namespace std;int main(){ string s; vector words; map count; while(cin>>s){ if(s[0] == '#')break; words.push_back(s); for(int i=0;i<s
2016-07-28 17:02:10 255
原创 101 The Blocks Problem
#include #include #include using namespace std;vector > pile;int n,a,b;void find_pos(int wood,int &p,int &h){ for(p=0;p<n;p++){ for(h=0;h<pile[p].size();h++){ if(pile[p][h] == wood)return;
2016-07-28 14:35:56 243
原创 512 - Spreadsheet Tracking
#include #include #include #include using namespace std;void operation(vector > & vec, int pos, char type, char rc) { if (type == 'D') { if (rc == 'R') vec.erase(vec.begin() + pos); else for
2016-07-27 23:03:57 265
原创 1339 Ancient Cipher
#include #include #include #include #include using namespace std;int main(){ string a,b; int cnt_origin[256]; int cnt_encrypted[256]; while(cin>>a>>b) { memset(cnt_origin,0,sizeof(int)*2
2016-07-25 14:06:29 209
原创 11809 - Floating-Point Numbers
这个主要是数学问题,需要用到查表的方法。对于所有的情况,计算出十进制小数的底数和指数,接受输入查询输入的底数和指数对应的浮点数的阶码和尾数位数。#include #include #include #include #include using namespace std;struct format{ double A; int B;};int main(){ v
2016-07-23 18:41:53 240
原创 1588 - Kickdown
取a是主动轮b是从动轮和b是主动轮a是主动轮两种组合中啮合长度最小的。#include #include using namespace std;inline int char_add(char c1,char c2){ return c1-'0' + c2-'0';}int min(int a,int b){return a<b?a:b;}int main(){ string
2016-07-23 17:00:27 353
原创 1587 - Box
这道题乍一看挺简单,总想找一些简单的方法,但是并不容易。还是用比较笨的方法吧,就是把输入的数据顺序排好,一点儿一点儿的判断。长方形的每个面的边长(x,y),按x>=y来记录。最后12个边面排好序应该是 (a,b)(a,b)(a,c)(a,c)(b,c)(b,c)。然后判断是否满足这种形式就可以了。12个数据应该是没有冗余的,都用得到。#include #include #inclu
2016-07-23 14:49:33 269
原创 10340 - All in All
#include #include #include using namespace std;const int MAX = 3005;int main(){ string s, t; while (cin >> s >> t) { int j = 0; bool ok = false; for (int i = 0; i < s.size(); i++){ f
2016-07-21 18:29:25 242
原创 202 - Repeating Decimals
这个主要是怎么寻找循环节,在除法计算的过程中如何判断一个循环节已经出现了。循环节第二次出现意味着计算过程中的余数已经第二次出现。其实自己在草纸上写一个比如5/7就能发现。当商5的时候(5是循环节的最后一位)余数是5,这和第一次商0的时候(0是循环节前一位)余数也是五。然后用索引存储是否这个余数已经出现过,还有一个数组记录余数对应的商的位置。余数的范围是1~m-1,所以循环节最长是m-1,所以查询数
2016-07-20 16:46:49 933
原创 1368 - DNA Consensus String
#include #include #include #include using namespace std;struct cell{ char ch; int n; cell(char c ='-',int t=0):ch(c),n(t){} bool operator<(const cell & cl)const{ if(n>cl.n)return true; e
2016-07-18 22:09:21 250
原创 232 - Crossword Answers
#include #include #include #include using namespace std;struct cell{ int id; string word; cell(int i,const string & w):id(i),word(w){} bool operator<(const cell & c)const{ return id<c.id;
2016-07-18 19:34:59 204
原创 227 - Puzzle
#include #include #include #include using namespace std;void display(const vector & puzzle){ for(int i=0;i<5;i++) { for(int j=0;j<5;j++) { if(j != 4)cout<<puzzle[i][j]<<" "; else cou
2016-07-18 19:34:07 227
原创 455 - Periodic Strings
#include #include using namespace std;int main(){ int n; cin>>n; bool first = true; for(int j=0;j<n;j++) { string input; cin>>input; for(int i=1;i<=input.size();i++) { if(input.siz
2016-07-18 19:33:34 156
原创 1225 - Digit Counting
#include #include #include using namespace std;int main(){ int n,m; cin>>n; for(int i=0;i<n;i++) { cin>>m; vector counts(10); for(int j=1;j<=m;j++) { int t=j; while(t) {
2016-07-18 19:32:51 159
原创 1586 - Molar mass
#include #include #include using namespace std;int main(){ string input; int n; cin>>n; for(int j=0;j<n;j++) { cin>>input; int cnt = 1; double m =0.0; double res_m = 0.0; for(int i=0;i
2016-07-18 19:31:55 151
原创 1585 - Score(lrj3-1,2th)
最近开始按照刘汝佳的书开始刷题了,第二版的入门经典。本人水平很渣,希望各位对我写的代码多提意见。#include #include using namespace std;int main(){ int n; cin>>n; string input; for(int i=0;i<n;i++) { cin>>input; int cnt=1; int res=0;
2016-07-18 19:28:11 217
转载 OpenGL环境配置
今天安装opengl的时候遇到了不少的阻碍,主要是gl,glu,glut,glew,glaux等众多的库之间的关系搞不明白,毕竟刚接触opengl。而且根据实际安装和使用的情况来看,容易出错的地方也有很多。总之感觉opengl并不好用,这也是目前opengl不如directx的原因吧,至少在配置的时候就不太友好。在这里把遇到的坑点都记录下来坑点零:安装过程,因为要下载的库的种类有些
2016-06-22 21:54:44 218
原创 Linux下的V4L2 相关配置
前几天弄linux 下的摄像头,主要是用在嵌入式的图像处理上。关于v4l2的资料比较多的,主要是明白各种数据结构的含义,随便一搜就有很多,这里提供一个写好的示例。对外接口很简单:1)通过设备文件名打开摄像头。2)读入帧,读入的格式是opencv格式的BGR排列顺序的24bit图像3)关闭摄像头函数为了简洁,所以没有提供设置参数的借口,各种设置已经硬编码在里面了。还有就是
2016-04-15 20:42:16 2111
转载 poj题目分类
POJ上的一些水题(可用来练手和增加自信)(poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094)初期:一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法.
2016-03-16 09:19:29 362
原创 1109. Group Photo (25)
Formation is very important when taking a group photo. Given the rules of forming K rows with N people as the following:The number of people in each row must be N/K (round down to the nearest in
2016-03-15 13:08:59 701
原创 1108. Finding Average (20)
Formation is very important when taking a group photo. Given the rules of forming K rows with N people as the following:The number of people in each row must be N/K (round down to the nearest in
2016-03-14 23:18:14 926
原创 1105. Spiral Matrix (25)
This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is filled in from the first element at the upper-left corner, then move in
2016-02-27 13:49:16 225
原创 1107. Social Clusters (30)
When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A "social cluster" is a set of people who have some of th
2016-02-24 00:44:56 505
原创 1106. Lowest Price in Supply Chain (25)
A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on
2016-02-24 00:43:20 223
原创 1104. Sum of Number Segments (20)
Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence {0.1, 0.2, 0.3, 0.4}, we have 10 segments: (0.1) (0.1, 0.2) (0.1, 0.2, 0.3)
2016-02-24 00:42:25 189
原创 1103. Integer Factorization (30)
The K-P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are supposed to write a program to find the K-P factorization of N for any positive
2016-02-24 00:31:53 293
原创 1102. Invert a Binary Tree (25)
The following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a whiteboard so fuck off.Now it's your turn
2016-02-23 21:12:50 227
原创 1101. Quick Sort (25)
There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the elements less than the pivot are moved to its le
2016-02-23 21:12:01 224
原创 1100. Mars Numbers (20)
People on Mars count their numbers with base 13:Zero on Earth is called "tret" on Mars.The numbers 1 to 12 on Earch is called "jan, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec" on Ma
2016-02-23 21:03:27 212
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人