- 博客(12)
- 资源 (4)
- 收藏
- 关注
原创 独木舟旅行(简单贪心)
#include<iostream>#include<algorithm>using namespace std;int weight[400];//简单的贪心,只要排序后体重小的去和体重大的一起就好了int main(){ int N; int n, w; while (cin >> N) { while (N--) { wh...
2018-03-27 08:55:20 394
原创 过河问题
思路:贪心思想(一般都是先排序)关键步骤:每次从此岸到彼岸移动的两个人要么这两个人中有一个是最快的那个人,要么这两个人到达彼岸后再也不回来。即:要么最快+最慢,要么最慢+次慢。1.对N个人过河时间从小到大排序。speed[i]2.分情况讨论:⑴当n = 1,直接过河。sum = speed[0](2)当n = 2,直接过河。 sum = speed[1](3)当n = 3,无论怎么过河, sum ...
2018-03-26 21:03:45 591
原创 会场安排
#include<iostream>//经典贪心会议安排#include<algorithm>#include<cmath>using namespace std;struct F { double begin; double end;}s[10001];bool cmp(F a, F b){ return a.end < b.end...
2018-03-26 16:55:54 510
原创 喷水装置(二)
#include<iostream>//dp问题,求一个区间覆盖问题的贪心,和会议安排是不同的,其实核心和最长公共子序列比较像#include<algorithm>#include<cmath>using namespace std;struct F { double x; double r; double l; double begin; d...
2018-03-25 15:37:12 278
原创 喷水装置(一)
#include<iostream>#include<algorithm>#include<cmath>//贪心问题,圆形面积转化分析,实际有效面积其实是一个矩形,所以用矩形的长度填满了目标长度即可using namespace std;struct F { double r; double l;}s[10000];bool cmp(F a, ...
2018-03-25 14:01:01 1078
原创 1051LIS木棍问题
#include<iostream>#include<algorithm>using namespace std;struct wood { int len; int wei; bool v ;//用来标记防止重复访问}w[5001];bool cmp(wood a, wood b){ if (a.len == b.len) return a.w...
2018-03-13 17:26:02 233
原创 1050房间桌椅转移
#include<cstdio>#include<cstring>#include<algorithm>using namespace std;//这是区间最大重载数问题 int main() { int t, n, count[410], i, start, end, k; scanf("%d", &t); while (t--) { ...
2018-03-12 21:19:34 318
原创 1045堡垒冲突问题
#include<iostream>#include<algorithm>#include<iomanip>using namespace std;char map[5][5];int res;int n;bool judge(int x, int y){ if (map[x][y] != '.') return false; for (...
2018-03-12 21:18:54 383
原创 豆豆战场
#include"stdafx.h"#include<graphics.h>#include<conio.h>#include<stdio.h>#include<stdlib.h>// 引用 Windows Multimedia API#pragma comment(lib,"Winmm.lib")#define Width 80...
2018-03-12 21:17:04 552
原创 双人弹小球
#include <conio.h>#include <graphics.h>#include<windows.h>#define High 480 // 游戏画面尺寸#define Width 640// 全局变量int ball_x, ball_y; // 小球的坐标int ball_vx, ball_vy; // 小球的速度int rad...
2018-03-12 21:10:28 378
原创 飞机大战
#include <graphics.h>#include <conio.h>#include <math.h>#include <stdio.h>// 引用 Windows Multimedia API#pragma comment(lib,"Winmm.lib")#define High 700 // 游戏画面尺寸#defin...
2018-03-12 21:09:07 934
原创 flapy bird
#include <graphics.h>#include <conio.h>#include<stdlib.h>#include<stdio.h>#pragma comment(lib,"Winmm.lib")IMAGE img_bk, img_bd1, img_bd2, img_bar_up1, img_bar_up2, img_...
2018-03-12 21:07:21 573
图书管理系统
2018-10-17
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人