摘要: 本来以为这题很难做。。。后来想了想发现不过是个贪心 ,因为每个过道的占用次数不论你怎么变换搬桌子顺序都不会变,所以 就把最大占用次数找出来 就知道最少耗时了开一个cor[201] 数组 来存过道的占用次数 注意到房间和过道的对应关系是 (奇数+1)/2 偶数 /2 因而可以建立房间与过道的对应关系题目及AC代码如下:Moving TablesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11544Accepted Submission(s): 阅读全文
posted @ 2014-03-25 08:41 VOID修罗 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 简单的dp 最长公共子序列问题 dp的方程如下:AC代码如下 1 #include 2 #include 3 4 const int max_n=1000; 5 6 int dp[max_n][max_n]; 7 char s1[max_n],s2[max_n]; 8 9 int max(int a,int b)10 {11 return a>b?a:b;12 }13 14 15 16 int main(void)17 {18 int i,j;19 int len1=strlen(s1);20 int len2=strlen(s2);21 whil... 阅读全文
posted @ 2014-03-18 22:46 VOID修罗 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 前些日子发生了些事情。。拖累了我刷题的脚步。。。不能这么容易就因为外物动摇 。。。今天起继续 每天都会发布代码先贴题 这个需要学习1391: Big Big Power时间限制:1 Sec内存限制:256 MB提交:123解决:14题目描述Calculate the power num a^(b^c) mod 1e9+7输入Multiple test cases,each case has three integers a,b and c . a,b,c is less than 1e9;输出Output the answer in each line样例输入2 3 2样例输出512这道题的解 阅读全文
posted @ 2014-03-15 11:30 VOID修罗 阅读(340) 评论(1) 推荐(1) 编辑
该文被密码保护。 阅读全文
posted @ 2014-03-13 13:06 VOID修罗 阅读(4) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2014-03-12 19:05 VOID修罗 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 /**此GetOpenFlename 调用的文件打开对话框需要 Comdlg.lib 这个库的连接**/ 5 int WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hPrevinstance,PSTR szCmdLine,int iCmdLine) 6 { 7 OPENFILENAME ofn; 8 char szFile[MAX_PATH]; //MAX_PATH 260 Windows下文件名最大长度 9 ZeroMemory... 阅读全文
posted @ 2014-03-09 20:57 VOID修罗 阅读(253) 评论(0) 推荐(0) 编辑
摘要: Windows编程 第一课 note 1 #include 2 #include "stdafx.h" 3 int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevinstance, PSTR szCmdLine, int iCmdShow) 4 /*WinMain是Windows程序的main函数 5 HINTSTACE hinstance 程序实例句柄 6 PSTR szCmdLine (在命令行下用什么启动)用的命令行参数*/ 7 { 8 9 int r=MessageBox(NULL, TEXT("这是 阅读全文
posted @ 2014-03-09 08:53 VOID修罗 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 真心好水的题。。。。 只需要求出砖块数目的平均值 ,再用每一摞砖的数目减去平均值 ,只取相减后大于0的或者只取小于零的相加 得到的和就是最少次数注意输出两个回车 题目及AC代码如下 Box of BricksLittle Bob likes playing with his box of bricks. He puts the bricks one upon another and builds stacks of different height. ``Look, I've built a wall!'', he tells his older sister Alic 阅读全文
posted @ 2014-03-08 15:45 VOID修罗 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 额。。 不理解这题为什么会是数学题 0.0 可能是输入中有很长的字符串需要处理,然后获得字符串的位数是一个需要技巧的过程? 不过我直接STL过的 。。。真心感觉STL很方便 但是也不能依赖STL额。。顺便总结一下输出的时候如果没要求最后不输出回车 最后一定要输出回车 否则就会WAWAWA 我在这栽了三次 = =以下是题和AC代码 Secret ResearchAt a certain laboratory results of secret research are thoroughly encrypted. A result of a single experiment is stored 阅读全文
posted @ 2014-03-07 15:11 VOID修罗 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 这个题 玩过魔方的可能做起来比较简单 ,我是从魔方的想法中得到了 对于相同的Cube,无论如何旋转 每个面的相对位置不变 ,因此 我把位置一对一对读入字符串 然后 两个字符串都按照规定顺序排序 然后比较这两个字符串是否相同 就可以得到结论了 题目及AC代码如下:Cube paintingWe have a machine for painting cubes. It is supplied with three different colors: blue, red and green. Each face of the cube gets one of these colors. The c 阅读全文
posted @ 2014-03-06 21:50 VOID修罗 阅读(149) 评论(0) 推荐(0) 编辑