• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
FightingForWorldFinal
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 ··· 5 6 7 8 9 10 下一页
2013年7月12日
HDU1086判断线段相交
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 using namespace std ; 13 #ifdef DeBUG 14 #define bug assert 15 #else 16 #define bug // 17 #endif 18 #define eps 1e-6 19 struct segment 20 { 21 double x... 阅读全文
posted @ 2013-07-12 14:30 Sky-J 阅读(347) 评论(0) 推荐(0)
2013年7月11日
高效大数模板
摘要: 1 #include 2 #include 3 4 using namespace std; 5 6 const unsigned int MAX = 10000; //整型数组的最大长度 7 const long long WIDTHMAX = 1000000000; //整型数组val[MAX]的元素上限 8 const unsigned int WIDTH = 9; //输出整型数组val[MAX]的元素时的格式宽度,即整型数组val[MAX]的元素的最多位数 9 10 typedef struct node 11 { 12 long long ... 阅读全文
posted @ 2013-07-11 21:44 Sky-J 阅读(288) 评论(0) 推荐(0)
HDUOJ2298三分加二分
摘要: 首先这题是一道物理题,需要我们根据题意抽象一个函数出来。对物体的运动作分解后,可以得到:f(t)=x*tan(t)-g*x*x/(v*cos(t))^2/2,其中t表示v与x轴正向的夹角(弧度),f(t)表示物体的运动轨迹与直线x0=x的交点纵坐标。分析后可以得到该函数在区间(0,π/2)上先增后减,所以我们可以在该区间上三分,求出使函数取得极大值的角度t0。若f(t0)#include#includeusing namespace std;const double eps=1.0e-9;const double PI=acos(-1.0);const double g=9.8;double 阅读全文
posted @ 2013-07-11 16:47 Sky-J 阅读(196) 评论(0) 推荐(0)
HDUOJ PIE二分查找
摘要: #include #include #include #include #include #include #include #include #include #include#includeusing namespace std ;#ifdef DeBUG#define bug assert#else#define bug //#endif#define eps 1e-6int m,n;double pie[11000];bool test(double x)//判断是否每个都分成出x体积大的蛋糕的块数>=人数,=人数那最好了^_^{int sum=0;for(int i=0;i=( 阅读全文
posted @ 2013-07-11 15:10 Sky-J 阅读(411) 评论(0) 推荐(0)
HDUoj 3714三分查找
摘要: #include #include #include #include #include #include #include #include #include #include#includeusing namespace std ;#ifdef DeBUG#define bug assert#else#define bug //#endif#define eps 1e-10double a[10010],b[10010],c[10010];int m;inline double f(double x){int i;double maxx=a[0]*x*x+b[0]*x+c[0];for(i 阅读全文
posted @ 2013-07-11 13:17 Sky-J 阅读(246) 评论(0) 推荐(0)
2013年7月10日
c++map使用方法
摘要: Map是c++的一个标准容器,它提供了很好一对一的关系,在一些程序中建立一个map可以起到事半功倍的效果,总结了一些map基本简单实用的操作!1. map构造函数;mapmapstring; mapmapint;mapmapstring; mapmapchar;mapmapchar; mapmapint; 2. map添加数据;map maplive; 1.maplive.insert(pair(102,"aclive"));2.maplive.insert(map::value_type(321,"hai"));3, maplive[112]=&quo 阅读全文
posted @ 2013-07-10 22:06 Sky-J 阅读(668) 评论(0) 推荐(0)
HDUOJ 1728逃离迷宫dp剪枝
摘要: #include using namespace std;#define inf 0x3fffffff#define M 105//1、wan用于转弯数剪枝;2、step用于步数剪枝,就不用vis标记访问了int r, c, ex, ey, k, wan[M][M];char mapp[M][M];int x_move[4] = {-1, 0, 1, 0};int y_move[4] = {0, 1, 0, -1};bool flag;int times=0;/*void showmap(int x,int y)//用这个可以打印出来研究{int i,j;printf("****** 阅读全文
posted @ 2013-07-10 20:52 Sky-J 阅读(450) 评论(0) 推荐(0)
2013年7月9日
HDUOJ 2553n皇后问题
摘要: N皇后问题Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5382Accepted Submission(s): 2454Problem Description在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Outpu 阅读全文
posted @ 2013-07-09 21:35 Sky-J 阅读(229) 评论(0) 推荐(0)
HDUOJ 2544最短路 自己第一次写出,纪念
摘要: 最短路Time Limit: 5000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 20910Accepted Submission(s): 8939Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N#include # 阅读全文
posted @ 2013-07-09 17:06 Sky-J 阅读(188) 评论(0) 推荐(0)
HDUOJ 2069 COINchange(母函数用的二维费用背包)
摘要: #include#include#include#include#includeusing namespace std;int main(){int dp[260][105];int a[5]={50,25,10,5,1};int n;memset(dp,0,sizeof(dp));for (int i = 0; i < 100; i++){dp[0][i]=1;}for (int i = 0; i < 5; i++){for (int j = a[i]; j <= 250; j++){for (int k = 1; k <= 100; k++){if (dp[j-a[ 阅读全文
posted @ 2013-07-09 11:15 Sky-J 阅读(230) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3