上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 40 下一页

2014年1月6日

POJ 2970 The lazy programmer 优先队列

摘要: --------------const double EPS = 1e-7;const int maxn=150000;int dcmp(double a,double b){ if (abs(a-b)b) return 1; else return -1;}struct Dat{ int a,b,d; double c; bool operatorque;int n;Dat a[maxn];int main(){ while (~scanf("%d",&n)){ while (!que.empty()) que.pop(); f... 阅读全文

posted @ 2014-01-06 00:53 电子幼体 阅读(312) 评论(0) 推荐(0) 编辑

2014年1月5日

SGU 180 Inversions 逆序数

摘要: --------------int n;int a[maxn];int b[maxn];struct BIT{ int n; int tree[maxn]; void init(int n){ this->n=n; memset(tree,0,sizeof(tree)); } int lowbit(int x){ return x&(-x); } void add(int x,int val){ for (int i=x;i0;i-=lowbit(i)) ret+=tree[i]; ... 阅读全文

posted @ 2014-01-05 19:38 电子幼体 阅读(145) 评论(0) 推荐(0) 编辑

SGU 271 Book Pile 双端队列

摘要: ------------int n,m,k;dequeque;vectorans;char cmd[22],c[4];;int bit;int main(){ scanf("%d%d%d",&n,&m,&k); que.clear(); ans.clear(); for (int i=0;ik){ ans.push_back(que.back()); que.pop_back(); } bit=1; for (int i=0;ik){ ans.push_back(que.back()); ... 阅读全文

posted @ 2014-01-05 13:23 电子幼体 阅读(196) 评论(0) 推荐(0) 编辑

2013年12月30日

从无到有的Java小游戏开发练习(一)---推箱子

摘要: 一、游戏功能游戏由障碍、空地、箱子、终点与玩家组成。通过上下左右控制玩家推动箱子。当箱子的推动方向没有障碍时,向前移动到新的位置,玩家也向前移动一步。当所有箱子都处于终点时,游戏胜利,按回车键进入下一关。当完成所有关卡时,按回车键结束游戏。在游戏中按R建重新开始本关。二、素材准备从网上下载推箱子游戏的地图素材与背景音乐。三、游戏的大致框架首先最容易想到的是一个管理地图信息的Map类,其中应该包括一个关卡地图中的所有信息。其次应该有一个 DataManager 类来从文件中读取地图、读取图片,并能根据读入的地图文件与关卡编号创造出所需的 Map 类的对象。还需要有一个 SoundManager 阅读全文

posted @ 2013-12-30 21:45 电子幼体 阅读(972) 评论(0) 推荐(0) 编辑

2013年12月5日

从零学起----Windows程序设计笔记(二) 窗口

摘要: ----------------#pragma comment(lib,"winmm.lib")#include LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow){ static TCHAR szAppName[] = TEXT("HelloWin"); HWND hwnd; MSG msg; WNDCLASS 阅读全文

posted @ 2013-12-05 16:07 电子幼体 阅读(167) 评论(0) 推荐(0) 编辑

从零学起----Windows程序设计笔记(一)

摘要: 一、Windows环境#include int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow){ MessageBox(NULL, TEXT("Hello Windows"), TEXT("HelloMsg"), 0); return 0;}1、WinMain的参数HINSTANCE hInstance 是执行实体句柄。HINSTANCE hPrevInstance 总是NULL(定义为0)。PSTR szCmdLine 阅读全文

posted @ 2013-12-05 14:38 电子幼体 阅读(174) 评论(0) 推荐(0) 编辑

2013年11月29日

Topcoder SRM 598 DIV 1

摘要: -------不服-------class BinPacking { private: int a[1000]; int n,m; int ans; public: int minBins(vector item) { memset(a,0,sizeof(a)); n=item.size(); sort(item.begin(),item.end(),greater()); m=0; ans=0; a[0]=300; for (int i=0;i<n;i... 阅读全文

posted @ 2013-11-29 21:07 电子幼体 阅读(148) 评论(0) 推荐(0) 编辑

2013年11月21日

Topcoder SRM 596 DIV 1

摘要: 250IncrementAndDoublingclass IncrementAndDoubling { private: int n; int a[55]; bool ok(){ for (int i=0;i desiredArray) { int res=0; n=sz(desiredArray); for (int i=0;i<n;i++) a[i]=desiredArray[i]; while (!ok()){ res+=check(); ... 阅读全文

posted @ 2013-11-21 12:31 电子幼体 阅读(130) 评论(0) 推荐(0) 编辑

Topcoder SRM 597 DIV 1

摘要: 250LittleElephantAndStringclass LittleElephantAndString { private: int ch[300]; public: int getNumber(string A, string B) { int ans=0; int n=A.length(); int p=n; memset(ch,0,sizeof(ch)); for (int i=0;i=0;i--){ bool ok=false; for (int j=... 阅读全文

posted @ 2013-11-21 12:27 电子幼体 阅读(149) 评论(0) 推荐(0) 编辑

2013年10月30日

ACM/ICPC 竞赛感想与总结

摘要: 打什么打,我们都是绅士...........-----------------------------------------------------------------------------------------------------2013 杭州:比赛过程见:2013 年亚洲赛杭州赛区卡题总结1、秒水题。2、一个小时搞出一题。3、焕神卡A题卡到死。4、秒博弈DP。。5、铜牌滚粗。------------------------------------------------------------------------------------------------------ 阅读全文

posted @ 2013-10-30 11:27 电子幼体 阅读(244) 评论(0) 推荐(0) 编辑

上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 40 下一页

导航