- 博客(35)
- 收藏
- 关注
原创 九度 oj 题目1114:神奇的口袋
http://ac.jobdu.com/problem.php?pid=1114#include int main(){ //freopen("in/1114.in","r",stdin); int n,dp[41],a[41]; while(scanf("%d",&n) !=EOF){ for (int i = 1; i <=n;
2017-01-27 14:34:25 512
原创 九度 oj 题目1112:拦截导弹
http://ac.jobdu.com/problem.php?pid=1112#include #include #include int main(){ //freopen("in/1112.in","r",stdin); int a[26], dp[26],n; while(scanf("%d",&n)!=EOF){ for
2017-01-27 13:28:59 275
原创 九度 oj 题目1111:单词替换
http://ac.jobdu.com/problem.php?pid=1111这一题我用了 stl#include #include using namespace std;int main(){ //freopen("in/1111.in","r",stdin); string str,newString, a,b; string::si
2017-01-27 13:08:13 464
原创 九度 oj 题目1140:八皇后
http://ac.jobdu.com/problem.php?pid=1140#include #include static int map[8][8];static int pos[8];static int ans[92],cn;void deploy(int i, int j, int v){ int _i=i,_j=j; while(_i<8) m
2017-01-25 16:43:30 371
原创 九度 oj 题目1131:合唱队形
http://ac.jobdu.com/problem.php?pid=1131两次动态规划 最长子序列#include #include #include int main(){ //freopen("in/1131.in","r", stdin); int height[102],n; int dpl[101],dph[101],i
2017-01-24 16:53:49 345
转载 九度 oj 题目1130:日志排序
http://ac.jobdu.com/problem.php?pid=1130参考了 http://www.cnblogs.com/jasonJie/p/5740646.html#include #include #include typedef struct date{ int year,month,day; friend bool oper
2017-01-24 16:07:19 339
原创 九度 oj 题目1119:Integer Inquiry
http://ac.jobdu.com/problem.php?pid=1119#include #include #include int main(){ //freopen("in/1119.in","r",stdin); int res[200],num[102],rlen,len,c,x; char str[102]; memset
2017-01-23 15:53:53 232
原创 九度 oj 题目1147:Jugs
http://ac.jobdu.com/problem.php?pid=1147好像 九度的oj judge 有问题,不对的code也可以过。建议使用 UVa的测试https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=512自己谢了bfs
2017-01-23 11:25:38 286
转载 九度 oj 题目1142:Biorhythms
http://ac.jobdu.com/problem.php?pid=1142此题利用了中国剩余定理参考了1.http://www.cnblogs.com/My-Sunshine/p/4830388.html2.http://blog.csdn.net/sinat_30126425/article/details/52154948代码来自于:参考2
2017-01-22 15:46:03 286
转载 计算器--可以计算合理表达是的计算器,包括+-×/()
参考了1.王道的机试复试书#include #include #include static int p[][7] = { /* $ + - * % ( )*/ /*$ */ { 0,-1,-1,-1,-1,-1,-2}, /*+*/ { 1, 1, 1,-1,-1,-1, 1}, /*-*/ { 1, 1,
2017-01-22 09:56:25 214
原创 九度 oj 题目1149:子串计算
http://ac.jobdu.com/problem.php?pid=1149#include #include #include typedef struct item{ char s[102]; int times; bool friend operator < (struct item a, struct item b){
2017-01-21 18:59:34 195
原创 九度 oj 题目1161:Repeater
http://ac.jobdu.com/problem.php?pid=1161#include static int N,Q; static char Map[3001][3001];static char Template[6][6];int myPow(int n,int q){ int m = 1; while(q--){ m*=n;
2017-01-21 17:15:26 534
转载 九度 oj 题目1160:放苹果
http://ac.jobdu.com/problem.php?pid=1160参考了1.http://blog.csdn.net/qq276592716/article/details/6851673#include #include int func(int m,int n){ if(m < 0) return 0; //There is n
2017-01-21 15:36:04 219
原创 九度 oj 题目1159:坠落的蚂蚁
http://ac.jobdu.com/problem.php?pid=1159#include #include typedef struct ant{ int pos,dir; bool friend operator < (struct ant a, struct ant b){ return a.pos < b.pos; }
2017-01-21 13:52:19 489
原创 九度 oj 题目1154:Jungle Roads
http://ac.jobdu.com/problem.php?pid=1154最小生成树:堆+并查集#include #include typedef struct edge{ int l,r,w; bool friend operator < (struct edge a, struct edge b){ return a.w > b.w;
2017-01-21 11:02:28 273
原创 九度 oj 题目1481:Is It A Tree?
http://ac.jobdu.com/problem.php?pid=1481最开始的版本只考虑到了,每个节点至多有一个父节点,最多有一个根。而忽略了有环,可空树的情况。参考了 1.http://www.cnblogs.com/newpanderking/archive/2012/10/14/2723260.html后*使用并查集来解决 唯一根,存在环,空树的情况
2017-01-21 10:18:13 293
转载 九度 oj 题目1486:False coin
http://ac.jobdu.com/problem.php?pid=1486参考了 1. http://blog.csdn.net/huahua520amy/article/details/98225612.http://blog.csdn.net/u011255131/article/details/53580630code 简化于 参考2#include
2017-01-19 16:56:21 208
原创 九度 oj 题目1480:最大上升子序列和
http://ac.jobdu.com/problem.php?pid=1480#include #include #include int main(){ //freopen("in/1480.in","r",stdin); int dp[1005],a[1005],n; while(scanf("%d",&n) !=EOF){
2017-01-19 11:10:43 293
原创 九度 oj 题目1162:I Wanna Go Home
http://ac.jobdu.com/problem.php?pid=1162#include #include const static int INF = 1000000000;static int dist[606];static bool visit[606];static int support[606];static int G[606][606];sta
2017-01-19 10:28:37 239
原创 所有组合, 所有排列的模板(从n个数中选m个数的所有组合和所有排列)
参考了 http://www.acmerblog.com/combinations-of-r-elements-6059.html#include #include void combine(int arr[], int data[], int start, int end,int idx,int r){ // has found r elements if(
2017-01-17 11:07:33 433
原创 九度 oj 题目1076:N的阶乘
http://ac.jobdu.com/problem.php?pid=1076#include #include #include using namespace std;#define MAXN 99999typedef struct bign{ int d[MAXN]; bign(string s){ int len = (int
2017-01-16 16:21:22 218
原创 九度 oj 题目1209:最小邮票数
http://ac.jobdu.com/problem.php?pid=1209这是一个巧合装满的0-1背包问题。#include #include int main(){ int m,n; int dp[105],stamp[21]; while(scanf("%d",&m) !=EOF ){ scanf("%d",&n
2017-01-16 14:57:14 254
转载 九度 oj 题目1208:10进制 VS 2进制
http://ac.jobdu.com/problem.php?pid=1208参考了1. http://blog.csdn.net/wzy_1988/article/details/86615932. http://blog.csdn.net/lhyer/article/details/48050359根据参考1有#include #include #
2017-01-16 13:38:05 494
转载 九度 oj 题目1080:进制转换
http://ac.jobdu.com/problem.php?pid=1080参考了1.http://blog.csdn.net/lhyer/article/details/480503592.http://blog.csdn.net/jaster_wisdom/article/details/52107785大整数的方法1.中int数组中的一个元素代表一位(
2017-01-15 21:48:09 295
原创 九度 oj 题目1082:代理服务器
http://ac.jobdu.com/problem.php?pid=1082因为每个proxy都可以用多次,所以使用贪心算法,局部最优迭代得到全局最优。 #include #include int main(){ //freopen("in/1082.in","r",stdin); char proxy[1002][16]; char
2017-01-15 17:01:18 369
转载 九度 oj 题目1081:递推数列
http://ac.jobdu.com/problem.php?pid=1081参考了(照抄了)http://blog.csdn.net/zxasqwedc/article/details/8763967 #include #include #include #define LL long longstatic LL a0,a1,p,q,k; typedef
2017-01-15 15:33:58 184
转载 九度 oj 题目1085:求root(N, k)
http://ac.jobdu.com/problem.php?pid=1085refs: 1.http://blog.csdn.net/JDPlus/article/details/18840577?locationNum=1&fps=12.http://blog.sina.com.cn/s/blog_8619a25801010wcy.htmlCode from
2017-01-15 11:39:13 199
转载 九度 oj 题目1084:整数拆分
http://ac.jobdu.com/problem.php?pid=1084照抄了 http://blog.csdn.net/jdplus/article/details/18839343参考了 http://www.cnblogs.com/yinger/archive/2012/08/17/2644312.html#include int main(){
2017-01-15 09:38:38 251
转载 九度 oj 题目1087:约数的个数
http://ac.jobdu.com/problem.php?pid=1087照抄了 http://blog.csdn.net/jdplus/article/details/18353667#include #include int main(){ //freopen("in/1087.in","r",stdin); int n; int
2017-01-14 21:15:49 196
原创 九度 oj 题目1086:最小花费
http://ac.jobdu.com/problem.php?pid=1086#include #include #include int main(){ //freopen("in/1086.in","r",stdin); long long l1,l2,l3,c1,c2,c3; int A,B; int n=0; int* a;
2017-01-14 20:54:25 230
转载 九度 oj 题目1491:求1和2的个数
http://ac.jobdu.com/problem.php?pid=1491参考了1. http://www.cnblogs.com/jy02414216/archive/2011/03/09/1977724.html2. http://www.myexception.cn/program/1846717.html (未使用)3. http://www.xuebuyua
2017-01-14 17:10:47 475
转载 九度 oj 题目1482:玛雅人的密码
http://ac.jobdu.com/problem.php?pid=1482参考了 http://blog.csdn.net/thyftguhfyguj/article/details/8994521#include #include #include static bool visit[1600000];typedef struct node{ c
2017-01-14 12:05:46 537
转载 九度 oj 题目1005:Graduate Admission
http://ac.jobdu.com/problem.php?pid=1005参考了 http://blog.csdn.net/abcjennifer/article/details/7292011#include #include #include #include typedef struct applicant{ int ge,gi,choice
2017-01-14 09:46:01 285
转载 九度 oj 题目1446:Head of a Gang
http://ac.jobdu.com/problem.php?pid=1446参考了 http://blog.csdn.net/jdplus/article/details/19759729并查集 && 双向hash#include #include #include typedef struct gang{ char head[4]; int
2017-01-13 16:58:08 262
转载 九度OJ 1437 To Fill or Not to Fill -- 贪心算法
#include #include #include typedef struct gas_station{ double price; int dis; friend bool operator < (struct gas_station a, struct gas_station b){ return a.dis < b.dis;
2017-01-12 16:53:40 432
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人