上一页 1 ··· 5 6 7 8 9 10 下一页
摘要: Hashmat the brave warriorInput:standard inputOutput:standard outputHashmat is a brave warrior who with his group of young soldiers moves from one place to another to fight against his opponents. Before fighting he just calculates one thing, the difference between his soldier number and the opponent& 阅读全文
posted @ 2011-11-20 21:28 xxx1 阅读(186) 评论(0) 推荐(0) 编辑
摘要: stack应用#include <iostream> #include <cmath> #include <stack> #define max 3005 using namespace std; int t[max]; stack<int> a; void clear() { while (!a.empty()) a.pop(); } int main() { int n; while (cin >> n) { int sub, tmp, flag = 1; for (int i = 1;... 阅读全文
posted @ 2011-11-16 23:30 xxx1 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Problem C: WERTYUA common typing error is to place the hands on the keyboard one row to the right of the correct position. So "Q" is typed as "W" and "J" is typed as "K" and so on. You are to decode a message typed in this manner.Input consists of several line 阅读全文
posted @ 2011-11-14 19:30 xxx1 阅读(270) 评论(0) 推荐(0) 编辑
摘要: /** @version 1.0 @author Katongmao Lee o(∩_∩)o */import java.awt.*;import java.awt.event.*;import javax.swing.*;public class Calculator1{ public static void main(String[] args) { CalculatorFrame frame = new CalculatorFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.show(); frame. 阅读全文
posted @ 2011-10-31 18:37 xxx1 阅读(382) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> template <class elem> void swap(elem a[], int p1, int p2) { elem tmp = a[p1]; a[p1] = a[p2]; a[p2] = tmp; } template <class elem> void print(elem a[], int length) { for (int i = 0; i < length; i++) std::cout << a[i] << ' '; std::cout <& 阅读全文
posted @ 2011-09-18 17:00 xxx1 阅读(203) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>template <class elem>void swap(elem a[], int p1, int p2){ elem tmp = a[p1]; a[p1] = a[p2]; a[p2] = tmp;}template <class elem>void print(elem a[], int length){ for (int i = 0; i < length; i++) std::cout << a[i] << ' '; std::cout << std 阅读全文
posted @ 2011-09-18 12:34 xxx1 阅读(193) 评论(0) 推荐(0) 编辑
摘要: template <class key, class Elem, class keyCompare, class EECompare>class Dictionary{public:virtual void clear() = 0;virtual bool insert(const Elem&) = 0;virtual bool remove(const key&, Elem&) = 0;virtual bool remove_any(Elem&) = 0;virtual bool find(const key&, Elem&) = 阅读全文
posted @ 2011-09-09 12:13 xxx1 阅读(657) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <math.h>#include <assert.h>int is_prime(int x){int i, m;assert(x >= 0);if (x == 1){return 0;}m = floor(sqrt(x) + 0.5);for (i = 2; i <= m; i++){if (x % i == 0){return 0;}}return 1;}int main(void){int i, m;scanf("%d", &m);for (i = m - 2; 阅读全文
posted @ 2011-09-07 21:25 xxx1 阅读(130) 评论(0) 推荐(0) 编辑
摘要: template <class type> class link{private:static link<type>* freelist;public:type element;link* next;link* prev;link(const type& a, link* pre = NULL, link* ne = NULL){element = a;next = ne;prev = pre;}link(link* pre = NULL, link* ne = NULL){next = ne;prev = pre;}void* operator new(siz 阅读全文
posted @ 2011-09-07 20:59 xxx1 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 通过重载new 和 delete 大大提高内存空间的分配速度。template <class type> class Link{type elememt;Link* next;Link(const type& ele, Link* ne == NULL){element = ele;next = ne;}Link(Link* ne = NULL){next = ne;}}template <class type> class link_list: public Link<type>{private:Link<type>* head;Lin 阅读全文
posted @ 2011-09-06 22:40 xxx1 阅读(190) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 下一页