Ombrophobic Bovines Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 16539 Accepted: 3605 Description FJ's cows really hate getting wet so much that the mere thought of getting caught in the rain makes them shake in their hooves. They have…
选择排序(假设递增排序) 每次选取从当前结点到末尾结点中最小的一个与当前结点交换,每一轮固定一个元素位置. 时间复杂度O(n^2),空间复杂度O(1).下面的示例代码以带头结点的链表为存储结构: #include<stdio.h> #include<stdlib.h> #define Elemtype double struct Node { Elemtype data; struct Node *next; }; void listsort(Node*h) { Node*p=h-…
A Knight's Journey Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 35564 Accepted: 12119 Description Background The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around…
Snowflake Snow Snowflakes Time Limit: 4000MS Memory Limit: 65536K Total Submissions: 34762 Accepted: 9126 Description You may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your…
Wormholes Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 35235   Accepted: 12861 Description While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way p…
DNA Sorting Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 88690 Accepted: 35644 Description One measure of unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in…
Binary Tree Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6355   Accepted: 2922 Description Background Binary trees are a common data structure in computer science. In this problem we will look at an infinite binary tree where the node…
Self Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 22101   Accepted: 12429 Description In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to…
#include<iostream> #include<stack> #include<stdio.h> using namespace std; struct node { __int64 num,pre,next; }; int main() { int n; freopen("in.txt","r",stdin); while(scanf("%d",&n)>0&&n) { s…
POJ 1511 Invitation Cards(单源最短路,优先队列优化的Dijkstra) //============================================================================ // Name : POJ.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-…