- 博客(40)
- 资源 (1)
- 收藏
- 关注
原创 bo_jwolf不卖萌的第二场解题报告
链接:http://www.bnuoj.com/bnuoj/contest_show.php?cid=3347#info重开:http://www.bnuoj.com/bnuoj/contest_show.php?cid=3349A、最大整数http://blog.csdn.net/bo_jwolf/article/details/17034393B、Dolla
2013-11-30 00:42:16 1289
原创 hm 与 zx 的故事系列1/2/3
题意:从首位开始,找到在其后的最近的每一位的比它大的数;解析;使用栈(stack)进行存储满足条件的值;从最后一个数进行入栈,当栈顶数大于当前位置时跳出此时循环(即证明,在当前位置后有至少一个比它大的数,而栈顶的值是最近的),否则进行出栈(即此时栈内值小于当前位置,当最后栈为空时,代表在当前位置后没有比它大的值,所以当前位置的值为0),最后将此时位置的值压入栈底;执行到最后,即刻筛出满足题
2013-11-30 00:39:56 1675
原创 Dollars
换硬币;解析:由于数据不大,只有50$,先统一单位,同乘以20;将每一中金额都预处理出来DP基础题;第一维代表金额数,第二位代表使用的货币的种类数;转移方程为dp[ i ][ j ] += dp[ i ][ j - 1]; //使用了i种币种,一定能用 i- 1种币种的种类,因为多的都可以用币种1表示; if( i >= num[ j ] )//当当前金额大于
2013-11-30 00:21:02 933
原创 最大整数
直接对string数组进行排序。需要注意的是,当string长度相等时,进行字典序排序,否则比较两字串进行组合的序列来排序;其中,str.c_str是将string类型转换成char,atoi是将char转换成int型;#include#include#include#include#include#include#includeusing namespace std;
2013-11-30 00:12:02 1079
原创 bo_jwolf卖萌的第三场(解题报告)
A - 上车人数http://blog.csdn.net/bo_jwolf/article/details/16495275B - 阶乘http://blog.csdn.net/bo_jwolf/article/details/16371281C - 加油站http://blog.csdn.net/bo_jwolf/article/details/1698979
2013-11-27 18:26:48 1001
原创 加油站
近乎枚举(采用下面方法进行了优化),说实话没什么讲的,关键理解清楚题目,车的行驶方向为单向(其实这个不应该做出特殊强调,但是就是有的同学会认为即刻正又可逆,因为题目仅要求求出能不能找到初始的车站,则尽可能的节省油);解析:不能找到,自然就是总的油量小于能加的油量。其次就是从第一个车站一个个向后枚举。需要注意的是:环形车站中能找到车站时,即认为可全部成环或当且仅当存在一个断层,即不连通,所以只要
2013-11-27 18:22:46 1114
原创 C(n,k)
C( n, k ) == n ! / ( k ! * ( n - k ) ! );由于判断的是C(n,k)的奇偶性,所以转换成统计分子和分母的2的个数,当分子2的个数大于分母,输出0即可// C(n,k).cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#includeusing namespace std;typedef
2013-11-27 18:13:55 2151
原创 Windy's S(II)
#include#include#include#include#include#include#includeusing namespace std;const int maxn = 1000000 ;char str[ maxn ];int next[ maxn ];int len ;void get_next(){ next[ 0 ] = -1 ; int j
2013-11-24 21:53:34 754
原创 flip
#include#include#include#includeusing namespace std;const int maxn = 105;int num1[ maxn ], num2[ maxn ];void Fun( int n, int a[], int &k ){ k = 0; while( n ){ a[ k++ ] = n % 2; n /= 2;
2013-11-24 20:54:34 984
原创 lentty's diary
理解为硬币拆分数即可;#include#includeusing namespace std;typedef long long LL;const int maxn = 35;LL num[ maxn ];void Start(){ num[ 0 ] = 1; num[ 1 ] = 1; for( int i = 2; i <= maxn; ++i ){ num[
2013-11-22 22:13:51 731
原创 DNA排序
题目直接暴力,但是考察了稳定排序和非稳定排序,使用sort直接WA了(不稳定排序),而使用stable_sort就过了(稳定排序)#include#include#include#includeusing namespace std;const int maxn = 1005;int n;struct node{ char str[ maxn ]; int val;
2013-11-22 21:16:39 1875
原创 Maximum Submatrix
最小01矩阵,Dp求解;同求最大子矩阵和类似,采用行/列存储总长度/和;#include #include#includeusing namespace std;#define MAXN 2010int h[MAXN],r[MAXN],l[MAXN];int map[MAXN][MAXN];char str[2];int n,m;void all_0_matrix()
2013-11-22 20:14:52 1473
原创 Bachelor's song
题目不难,但使用string中的find判断是否存在,且返回首字母的位置;由于为字符串,所以只要首字母小于总长度减去查询字符长度即可;#include#include#include#includeusing namespace std;const int maxn = 10005;int main(){ string str; string::size_type posi
2013-11-22 20:12:36 1071
原创 扑克游戏
题目不难,但是仍然要想清除;易得赢得总数等于输的总数;例如输入的为B、C、D其次最大赢家数和最小赢家数一定为一组,因此,排好序,未知量只能是A或者E;即A和D一组或者B和E一组;然后分情况讨论满不满足即可;// 扑克游戏.cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#include#includeusing
2013-11-18 13:43:20 993
原创 上车人数
真心感觉题目很好,除了数学思想,还有考察仔细读题了没(输入是a,n,题目描述是n,a)题意:中文;解析:车站编号: 1 2 3 45 6 7上车人数 a ba + b a + 2*b2*a+3*b 3*a+5*b......下车人数 0 bb a + ba+2*b 2*a+3*b......剩下的人数 a a 2 * a
2013-11-17 20:39:54 1873
原创 阶乘
// 阶乘.cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#includeusing namespace std;#define Mod 100000//int _tmain(int argc, _TCHAR* argv[])int main(){ int n, m, Case; cin >> Case; whi
2013-11-17 18:35:47 1041
原创 BlueEyes' Schedule
// BlueEyes' Schedule.cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#include#include#includeusing namespace std;const int maxn = 1005;struct node{ int x, y; bool operator<( const n
2013-11-17 13:40:39 1160
原创 FatMouse的奶酪
// FatMouse的奶酪.cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#includeusing namespace std;const int maxn = 1005;int num[ maxn ];//int _tmain(int argc, _TCHAR* argv[])int main(){ int
2013-11-17 01:38:36 1042
原创 littleken bg
// littleken bg.cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#include#include#includeusing namespace std;const int maxn = 205;int dp[ maxn ], num[ maxn ], weight[ maxn ], value[ maxn
2013-11-17 01:01:33 1166
原创 Text Encryption
// Text Encryption.cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#include#include#include#includeusing namespace std;const int maxn = 1005;char str1[ maxn ], str2[ maxn ];//int _
2013-11-16 20:21:19 1006
原创 Dollars
// Dollars.cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#includeusing namespace std;const int maxn = 1005;int num[ 15 ] ={ 1, 2, 4, 10, 20, 40, 100, 200, 400, 1000, 2000 };
2013-11-16 14:48:58 904
原创 How many sums?
// How many sums.cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#includeusing namespace std;const int maxn = 501;long long num[ maxn ] = { 1 };void Start(){ for( int i = 1;
2013-11-16 12:38:02 832
原创 Maximum Sum
#include#include#includeusing namespace std;const int maxn = 1005;int dp[ maxn ][ maxn ], num[ maxn ][ maxn ];int main(){ int n; while( cin >> n ){ memset( num, 0, sizeof( num ) ); for(
2013-11-16 02:50:37 818
原创 Chopsticks
题意:有一个怪人吃饭喜欢用三根筷子,现在他想请他的朋友n个人+8(一定会有的家人亲戚),每个人也要分配3根筷子,现在给你n和筷子总数k,然后下一行是k根筷子的长度;现在要求A解析;转移方程:dp[ i ][ j ] = min( dp[ i ] [ j - 1 ], dp[ i - 1 ] [ j - 2 ] + num[ j ] ,第一维代表人数,第二维代表筷子数,即第一个为第i个人现在选
2013-11-15 22:45:45 1455
原创 The Hardest Problem Ever
#include#include#include#includeusing namespace std;const int maxn = 1005;char temp[ maxn ], str[ maxn ];void Deal( char* str ){ int len = strlen( str ); for( int i = 0; i < len; ++i ){
2013-11-14 17:04:15 802
原创 数字三角
// 数字三角.cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#include#include#includeconst int maxn = 105;int dp[ maxn ][ maxn ], num[ maxn ][ maxn ], mid[ maxn ][ maxn ];using namespace std
2013-11-14 14:13:58 823
原创 SCU's Bathhouse
// SCU's Bathhouse.cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#includeusing namespace std;//int _tmain(int argc, _TCHAR* argv[])int main(){ int Case, n; cin >> Case; while( Case-
2013-11-14 13:17:41 977
原创 RADAR Brands
// ??? I.cpp : ??????????????////#include "stdafx.h"#include#include#includeusing namespace std;const int maxn = 105;int num1[ maxn ], num2[ maxn ];int Judge( int n ){ int k = 0; w
2013-11-14 13:08:22 919
原创 回文数 I
// 回文数 I.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include#include#includeusing namespace std;const int maxn = 105;int num1[ maxn ], num2[ maxn ];int Judge( int n ){ int k = 0; while( n
2013-11-14 13:07:20 856
原创 矩形的个数
// problem.cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#include#includeusing namespace std;//int _tmain(int argc, _TCHAR* argv[])int main(){ int m, n; while( cin >> m >> n )
2013-11-13 22:32:18 901
原创 大小写转换
// 大小写转换.cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#include#include#include#includeusing namespace std;const int maxn = 1005;char str[ maxn ];//string str;//int _tmain(int argc
2013-11-13 22:21:21 1078
原创 Move cards
// Move cards.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include#includeusing namespace std;const int maxn = 105;int num[ maxn ];int main(){ int Case, n; cin >> Case; while( Case-- ){
2013-11-13 22:11:36 867
原创 bo_jwolf卖萌的第二场(总结+解题报告)
总结:总体难度:无限水。。。。。。水题大战,下场及以后不会再有,所以请各位同学做好心里准备及平时加强训练;题目难度虽然小,但是也反映出我们整体基础不够牢靠,例如,读题水平,这就需要我们加强英语水平,所有比赛中,难题不会有很多,绝大多数题目是中等及以下难度,因为ACM毕竟是一场竞赛,无论你做出别人做出的难题,看起来多么多么厉害,但是,中下难度的题目做不出来,同样无法获得好的成绩;我总有一句话:金
2013-11-13 19:46:21 1272
原创 C Looooops
裸线性同余方程// C Looooops.cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#include#includeusing namespace std;#define LL __int64LL ex_gcd( LL a , LL b , LL &x ,LL &y ){ if ( b == 0 )
2013-11-13 19:14:53 1916
原创 Discrete Logging
#include#include#include#include#include#include#includeusing namespace std;//模板,A ^ B % C = K ,求 B #define maxn 65535struct hash{ int a , b , next ;}Hash[ maxn * 2 ] ;int flg[ maxn +
2013-11-13 19:12:26 1240
原创 Buy Tickets
http://poj.org/problem?id=2828线段树单点更新题意:场景为排队买票,按照输入,可以插队,问最后的队列的顺序是怎么样的解析:以序号构造线段树,以左子树来记录,然后查询并更新相应位置的编号(第二个数值);// Buy Tickets.cpp : 定义控制台应用程序的入口点。////#include "stdafx.h"#include#in
2013-11-11 21:16:10 1026
原创 bo_jwolf卖萌的第一场
内网比赛,重开链接http://acm.hust.edu.cn/vjudge/contest/view.action?cid=36366#overview题解链接,点击标题素数基础运用Prime Test米勒拉宾素数测试的经典运用,目的:养成良好的习惯,积累经典模板Prime CutsPrime LandPrime GapPrime Path
2013-11-11 20:25:53 1233
原创 Ones
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=36366#problem/E#includeint main(void){ int n,cnt,tmp; while(scanf("%d",&n)!=EOF) { tmp=1; cnt=1; while(tmp&& n) { tmp=tmp*1
2013-11-11 20:25:22 869
原创 Prime Path
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=36366#problem/J#include#include#includeusing namespace std;bool num[10001],used[10001];int s,e;void Prim(){ memset(num,true,sizeo
2013-11-11 20:18:35 1225
原创 Prime Test
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=36366#problem/A#include #include #include #include #include #include #include using namespace std;/* ******************************
2013-11-11 19:48:29 1369
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人