摘要:Lost CowsTime Limit:1000MSMemory Limit:65536KTotal Submissions:8101Accepted:5163DescriptionN (2 int result[10001];int arr[10001];int a[10001];int n; int lowbit(int num){ return num & -num;}void plus(int pos, int num){ while(pos 0) { sum += arr[pos]; pos -= lowbit(pos); } ...
阅读全文
摘要:AlignmentTime Limit:1000MSMemory Limit:30000KTotal Submissions:10672Accepted:3414DescriptionIn the army, a platoon is composed by n soldiers. During the morning inspection, the soldiers are aligned in a straight line in front of the captain. The captain is not satisfied with the way his soldiers are
阅读全文
摘要:Human Gene FunctionsTime Limit:1000MSMemory Limit:10000KTotal Submissions:15181Accepted:8419DescriptionIt is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters, A, C, G, and T. Biologists have been interested in iden
阅读全文
摘要:Cow BowlingTime Limit:1000MSMemory Limit:65536KTotal Submissions:11758Accepted:7721DescriptionThe cows don't use actual bowling balls when they go bowling. They each take a number (in the range 0..99), though, and line up in a standard bowling-pin-like triangle like this: 7 3 8 ...
阅读全文
摘要:What Are You Talking AboutTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 102400/204800 K (Java/Others)Total Submission(s): 9522Accepted Submission(s): 2971Problem DescriptionIgnatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian
阅读全文
摘要:Hat’s WordsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5201Accepted Submission(s): 1940Problem DescriptionA hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary.You are to find all the ha
阅读全文
摘要:有四个线程1、2、3、4。线程1的功能就是输出1,线程2的功能就是输出2,以此类推.........现在有四个文件ABCD。初始都为空。现要让四个文件呈如下格式:A:1 2 3 4 1 2....B:2 3 4 1 2 3....C:3 4 1 2 3 4....D:4 1 2 3 4 1....请设计程序。#include <stdio.h>#include <stdlib.h>#include <iostream> #include <string> #include <stack> #include <windows.h&
阅读全文
摘要:编写一个程序,开启3个线程,这3个线程的ID分别为A、B、C,每个线程将自己的ID在屏幕上打印10遍,要求输出结果必须按ABC的顺序显示;如:ABCABC….依次递推。#include <stdio.h>#include <stdlib.h>#include <iostream> #include <string> #include <stack> #include <windows.h> #include <process.h> using namespace std; HANDLE hEventA;HAND
阅读全文
摘要:Ultra-QuickSortTime Limit:7000MSMemory Limit:65536KTotal Submissions:32539Accepted:11599DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in
阅读全文
摘要:输入二叉树两个节点的值,求解这两个节点间的距离#include <stdlib.h>#include <stdio.h>typedef struct node{ int data; node *lchild; node *rchild;}TreeNode;int node1, node2;int length = 0;int flag = 0;bool FindNode(TreeNode *pRoot){ if (pRoot == NULL) { return false; } if (pRoot->lchild != NULL) ...
阅读全文
摘要:Phone ListTime Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6713Accepted Submission(s): 2290Problem DescriptionGiven a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone cata
阅读全文
摘要:统计难题Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 12800Accepted Submission(s): 5413Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统
阅读全文
摘要:volatile和const关键字一样,是一个类型修饰符,表示变量可以被编译器的某些未知因素修改,比如操作系统,硬件,某些线程等。遇到这个关键字声明的变量,编译器访问该变量的代码将不再进行优化,以提供对特殊地址的稳定访问。 有代码如下: int i = 10;int j = i;//语句1int k = i;//语句2这时候编译器进行代码优化,因为在语句1和语句2中,i不作为左值,编译器认为i的值没有发生变化,所以在语句1中将i的值取出赋给j之后i的值并未丢弃,而是在语句2中继续赋给k编译器不会产生汇编代码重新从i里面取值,这样做提高了效率,但是要注意,语句i要没有用作左值才行。而且编...
阅读全文
摘要:zb的生日时间限制:3000ms | 内存限制:65535KB难度:2描述今天是阴历七月初五,acm队员zb的生日。zb正在和C小加、never在武汉集训。他想给这两位兄弟买点什么庆祝生日,经过调查,zb发现C小加和never都很喜欢吃西瓜,而且一吃就是一堆的那种,zb立刻下定决心买了一堆西瓜。当他准备把西瓜送给C小加和never的时候,遇到了一个难题,never和C小加不在一块住,只能把西瓜分成两堆给他们,为了对每个人都公平,他想让两堆的重量之差最小。每个西瓜的重量已知,你能帮帮他么?输入多组测试数据(<=1500)。数据以EOF结尾第一行输入西瓜数量N (1 ≤ N ≤ 20)第二行
阅读全文
摘要:素数环时间限制:1000ms | 内存限制:65535KB难度:2描述有一个整数n,把从1到n的数字无重复的排列成环,且使每相邻两个数(包括首尾)的和都为素数,称为素数环。为了简便起见,我们规定每个素数环都从1开始。例如,下图就是6的一个素数环。输入有多组测试数据,每组输入一个n(0<n<20),n=0表示输入结束。输出每组第一行输出对应的Case序号,从1开始。如果存在满足题意叙述的素数环,从小到大输出。否则输出No Answer。样例输入6830样例输出Case 1:1 4 3 2 5 61 6 5 2 3 4Case 2:1 2 3 8 5 6 7 41 2 5 8 3 4
阅读全文