- 博客(16)
- 收藏
- 关注
原创 习题5-6 对称轴(Symmetry, UVa1595)
//习题5-6 对称轴(Symmetry, ACM/ICPC Seoul 2004, UVa1595)/*定义 map, int> vis插入时赋值为1 vis[pair(x, y)]++;查询一个关键字是否存在:if(!vis[pair(x, y)]) ... 如果不存在会新建立一个关键字,返回值为0是否可以等同于if(!vis.count(pair(x, y))) ...呢?*/
2017-06-30 17:57:55 613
原创 习题5-5 复合词(Compound Words, UVa 10391)
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include "ChenHC.h"#define CLOSE() ios::sync_wi
2017-06-30 10:15:27 435
原创 5 - 12
//例题5-12 UVa221 Urban Elevations//1. ordered south-to-north, west-to-east.int graph[10005][10005];struct building { int x, y, w, d, h;}b[1005];bool cmp(const int &n, const int &m) { if (b[n].x
2017-06-29 20:46:28 357
原创 13.3. Swap
//Exercises Section 13.3//Exercise 13.29: Explain why the calls to swap inside swap(HasPtr&,//HasPtr&) do not cause a recursion loop.//For the swap inside function feed the library swap.//Exercis
2017-06-29 15:49:45 210
原创 13.2. Copy Control and Resource Management
//Exercises Section 13.2//Exercise 13.22: Assume that we want HasPtr to behave like a value.That//is, each object should have its own copy of the string to which the objects//point.We’ll show the d
2017-06-28 20:18:56 214
原创 13.1 Copy, Assign, and Destroy
/*class Sales_data {public: Sales_data(const Sales_data&);private: string bookNo; int units_sold = 0; double revenue = 0.0;};Sales_data::Sales_data(const Sales_data&orig): bookNo(orig.bookNo
2017-06-27 21:43:22 229
原创 15.6. Class Scope under Inheritance
//15.6. Class Scope under Inheritanceclass Quote {public: Quote() = default; Quote(const string &book, double sales_price): bookNo(book), price(sales_price) { } string isbn() const { re
2017-06-26 16:29:37 157
原创 15.4. Abstract Base Classes
//Exercises Section 15.4//Exercise 15.15: Define your own versions of Disc_quote and//Bulk_quote.//Exercise 15.16: Rewrite the class representing a limited discount strategy,//which you wrote for
2017-06-26 16:25:08 214
原创 15.1, 15.2, 15.3, 15.5
//15.5 Access Control and Inheritance//A derived class member or friend may access the protected members of the base class only through a derived object./*class Base {protected: int prot_mem;
2017-06-24 09:07:08 472
原创 5-1 ~ 5-4
//5-1 UVa 1593 /* alignment n. 队列,成直线;校准;结盟 customizable adj. 可定制的 align vt. 排列 vertical adj. 垂直的,直立的;n.垂直线,垂直面 */ int main() { string s; vector > strcache;
2017-06-23 16:45:03 204
原创 5-1 ~ 5-11
//5-1 UVa 10474 /* int Marble[10005]; int T, Q; void Judge(int q) { int i; for(i = 1; i <= T; i++) { if(Marble[i] == q) break; } if(i != T+1) printf("%d
2017-06-23 16:25:59 403
原创 博弈
//博弈/*定义P-position和N-position1.无法进行任何移动的是P-position2.可以移动到P-position的是N-position3.所有移动都导致N-position的是P-position*///Bash博弈/*只有一堆石子,两人轮流取,最少取一个,最多取m个,最后去完者为胜。1.当石子个数n=0时为必败点2.当石子个数0<n<=m时为必胜
2017-06-14 18:25:57 184
原创 浪潮杯
//Problem: Quadrat/*这题属于打表找规律题。。半天题没读懂。。学了一波字符串转数字的操作。sprintf(a, "", b);sscanf(a, "", b);*/int n, K;bool Judge(char *s1, char *s2) { string a(s1), b(s2); int x1 = n - a.size(), x2 = n
2017-06-12 21:13:56 363
原创 图灵杯
//D.运用递归输出图形char a[2050][2050];void Paint(int x, int y) {//打印基本图形 a[x+1][y-1] = a[x][y] = '/'; a[x+1][y+2] = a[x][y+1] = '\\'; a[x+1][y] = a[x+1][y+1] = '_';}//观察图形发现一个n阶的图形由3个n-1阶的子
2017-06-12 08:59:40 966
原创 NEUOJ 73 Problem: Ready to declare
Finally, you find the most good-looking girl...You are going to write a letter to her. But you are not convident to be better than other boys. So you think you need a good chance...You have known that these days, she will meet N boys at all(N<=100000). T
2017-06-04 13:51:51 251
原创 Problem: fireworks
Hmz likes to play fireworks, especially when they are put regularly.Now he puts some fireworks in a line. This time he put a trigger on each firework. With that trigger, each firework will explode and split into two parts per second, which means if a fire
2017-06-03 13:32:30 198
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人