• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
tmeteorj
Nothing is so big that it is impossible to get over, and hurt only serves to make us stronger. 没有什么事是大到无法战胜的,痛苦也只会让我们变得更加坚强。
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 21 下一页

2012年10月3日

POJ 3047
摘要: 题意:求某天是星期几。题解:数学||模板View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 char name[][12] = { "monday", "tuesday", "wednesday", 6 "thursday", "friday", "saturday", "sunday&quo 阅读全文
posted @ 2012-10-03 13:19 tmeteorj 阅读(215) 评论(0) 推荐(0)
 
POJ 2722
摘要: 题意:给一个角和一些正方形,用正方形去把角封住,要求被封住的面积最大。题解:面积最大的时候,所有正方形的对角线必定练成一条直线然后与角相交,如原题的图中就可以把正方形沿着角向外平移一些直到正方形对角线共线,此时达到移动的临界点。接着就是数学公式推导,用三角形内角和180,正弦定理,平行线确定的一些角相等便可以退出公式。公式比较长,可以一步步运算出来。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<cmath> 4 #include<algorithm> 5 using nam 阅读全文
posted @ 2012-10-03 13:03 tmeteorj 阅读(274) 评论(0) 推荐(1)
 
POJ 1167
摘要: 题意:从0到59分内,来了n辆公交车,求最少公交车路线。每条公交线的发车时间间隔都一样,且在这段时间内每条路线至少发车两次,公交车路线最多为17.题解:预处理公交车可行路线的发车时间、间隔与车次,通过dfs求最小路线。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 int n,tot[70],top,ans; 6 struct Data 7 { 8 int start,ti,num; 9 bool operator& 阅读全文
posted @ 2012-10-03 12:23 tmeteorj 阅读(314) 评论(0) 推荐(0)
 
POJ 2641
摘要: 题意:在b*a的区域打台球,初始位置在中点,s秒之后,与水平边撞击n次,与垂直边撞击m次,并回到中点,求球的初速度与角度。题解:球的水平速度设为Vx,那么s秒后水平路程为Vx*s,与垂直边撞击m次又回到中点,由此得到水平路程为m*a,于是Vx*s=m*a,同理Vy*s=n*b,两式联立得答案。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<cmath> 4 using namespace std; 5 const double pi=acos(-1.0); 6 int main() 7 阅读全文
posted @ 2012-10-03 10:39 tmeteorj 阅读(160) 评论(0) 推荐(0)
 
 

2012年10月2日

POJ 2666
摘要: 题意:海上有地方发生爆炸,一个人与主船脱离,他想回到主船上去。爆炸的冲击波会使得主船沿着爆炸点到它的方向以V的速度远离,人有种装置确定主船位置,但是必须保证他到爆炸点的距离与船到爆炸点的距离一样,人的速度为2V,当前他们距离爆炸点的距离为D,人与船对于爆炸点的夹角为Θ,求人回到船的时间,如果大于10000,就输出"God help me!"。题解:为了保证人和船时时刻刻与爆炸点距离相等,所以人的径向速度也应为V,那么切向速度就是√3V,在t时刻,他到爆炸点的距离为D+tV,于是在dt时间内,他旋转的角速度就是(√3V)/(D+tV),角度为(√3V)/(D+tV)*dt=d 阅读全文
posted @ 2012-10-02 20:28 tmeteorj 阅读(163) 评论(0) 推荐(0)
 
POJ 3181
摘要: 题意:给出n和m,求[1,m]的数中有多少种的和是n题解:解法不是重点,就是一个简单的背包问题,dp[j+i]+=dp[j],1<=i<=m。问题是n<=1000,m<=100,超long long了,所以java BigInteger一水OK。View Code 1 import java.math.*; 2 import java.util.Arrays; 3 import java.util.Scanner; 4 class Main{ 5 static BigInteger dp[]=new BigInteger[1005]; 6 public static v 阅读全文
posted @ 2012-10-02 19:21 tmeteorj 阅读(250) 评论(0) 推荐(0)
 
POJ 2264
摘要: 题意:给出两个字符串,求新的长度最小的字符串,使得给出的两个字符串均是它的子序列。题解:要想最小,就是让两个字串合并起来时相同排列的尽可能合并成一个,即最长公共子序列。所以先求一遍最长公共子序列s,同时记录串s第i位分别是给出的两个字符串s1和s2的哪一位,如果对于s的第k位,对应于s1串的第i位,那么位于s1串i位之前未写进答案串的所有字符均应当在s[k]之前写进去,s2同理可得。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace 阅读全文
posted @ 2012-10-02 18:57 tmeteorj 阅读(232) 评论(0) 推荐(0)
 
POJ 2191
摘要: 题意:判断所有质数i<=k,2^i-1是否是质数,不是的话就要将它分解质因数输出来。题解:miller_rabin判,pollard-pho分解,基本就是枚举,也可以打表。View Code 1 #include<ctime> 2 #include<cstdio> 3 #include<cstring> 4 #include<cstdlib> 5 #include<algorithm> 6 using namespace std; 7 long long factor[100],fac_top = -1; 8 //计算两个数的g 阅读全文
posted @ 2012-10-02 16:53 tmeteorj 阅读(739) 评论(0) 推荐(0)
 
POJ 2649
摘要: 题意:判断m能否整除n!题解:0特判,其他情况对m分解质因数并统计个数,看n!是否含多余该个数的质因数,n!关于质因数p的个数=(n/p+n/p^2+n/p^3......),即求出mod p=0,mod p^2=0等的个数。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #include<cmath> 5 using namespace std; 6 const int mr=65536; 7 bool notp[mr]; 8 int pr[mr] 阅读全文
posted @ 2012-10-02 16:07 tmeteorj 阅读(288) 评论(0) 推荐(0)
 
POJ 1944
摘要: 题意:n个点的环,只能邻接点建边,现在要求m对点相连,求最小边。题解:最后必定是生成的一些链,否则可以把环打开少用一条边。那么可以枚举这个断点在哪,计算取最小值。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #include<queue> 5 using namespace std; 6 const int N=1005; 7 int to[N],po[10005][2],n,m; 8 int main() 9 {10 while(scanf(&q 阅读全文
posted @ 2012-10-02 15:18 tmeteorj 阅读(393) 评论(0) 推荐(0)
 
 
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 21 下一页

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3