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

2012年10月2日

POJ 3978
摘要: 题意:求区间[a,b]内所含质数个数。题解:筛一遍素数,二分查找。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 const int mr=100001; 6 bool notp[mr]; 7 int pr[mr]; 8 int pn; 9 void getpri()//筛素数10 {11 memset(notp,0,sizeof(notp));12 for(int i=2; i<mr; i++)13 {14 阅读全文
posted @ 2012-10-02 13:28 tmeteorj 阅读(185) 评论(0) 推荐(0)
 
POJ 3640
摘要: 题意:n个学生的5门课程,找出课程组合出现次数最多的,输出选出现次数最多课程组合(不一定一个)的学生人数。题解:对5门课程排序,然后hash判重,接着统计即可。View Code 1 #include<cstring> 2 #include<algorithm> 3 #include<string> 4 #include<map> 5 #include<cstdio> 6 using namespace std; 7 const int mod=1000000; 8 long long hash[mod]; 9 int tot[mod 阅读全文
posted @ 2012-10-02 13:13 tmeteorj 阅读(316) 评论(0) 推荐(0)
 
POJ 3332
摘要: 题意:检查输入字符串是否是浮点型。题解:模拟= =!View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #include<cctype> 5 using namespace std; 6 int main() 7 { 8 int T; 9 for(scanf("%d",&T); T; T--)10 {11 char s[1200];12 scanf(" %s",s);13 if(s[0]=='+&# 阅读全文
posted @ 2012-10-02 12:37 tmeteorj 阅读(256) 评论(0) 推荐(0)
 
POJ 1406
摘要: 题意:给定n,确定x*x*x+y*(y+1)*(y+2)/6使得不超过n且最接近n题解:n才十多万,直接打表。View Code 1 #include<cstdio> 2 #include<algorithm> 3 #include<cstring> 4 using namespace std; 5 const int N=160000; 6 bool mark[160000]; 7 int main() 8 { 9 memset(mark,false,sizeof(mark));10 for(int x=0;;x++)11 {12 int t=x*x... 阅读全文
posted @ 2012-10-02 12:17 tmeteorj 阅读(208) 评论(0) 推荐(0)
 
POJ 2193
摘要: 题意:一个长度为n的数列(a1,a2...an),满足a[n]<=m&&a[i]>=2*a[i-1],给你n,m,求满足要求数列个数。题解:dp[i][j]代表长度为i且a[i]=j的数列的种数,sp[i][j]代表长度为i且a[i]<=j的种数。dp[i][j]=sum(dp[i-1][k])(k<=j/2),sp[i][j]=sp[i][j-1]+dp[i][j];View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #in 阅读全文
posted @ 2012-10-02 11:19 tmeteorj 阅读(189) 评论(0) 推荐(0)
 
POJ 1143
摘要: 题意:两个人玩游戏,初始集合S为大于1的正整数集,轮流写出一个大于1的数然后将:“1、所有这个数的倍数;2、这个数的倍数与前面已经删去的数的和”从集合S中删去,现在告诉你S的现状,求所有必胜走法的第一步。题解:数的数量小于20,可以用位压缩dp,记录S中还剩哪些元素时是否是必胜态,然后通过记忆化搜索求出所有走第一步后是必败态的策略。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 int dp[(1<<20 阅读全文
posted @ 2012-10-02 10:23 tmeteorj 阅读(628) 评论(0) 推荐(0)
 
 

2012年10月1日

POJ 2810
摘要: 题意:字符串处理,分为a,b,c,d四部分,a,c为浮点数,b,d为字符串,除了d以外,其余均无中间空格。然后观察a*100/b,大于1就输出d a b a*100/b%,否则,就在最后一段话后将d输出。题解:同上。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 char ss[1000][1000]; 6 const double eps=1e-8; 7 int main() 8 { 9 char s[1000]; 阅读全文
posted @ 2012-10-01 20:40 tmeteorj 阅读(189) 评论(0) 推荐(0)
 
POJ 2379
摘要: 题意:模拟ACM Ranklist,按AC数,罚时,队伍编号排序。题解:注意2种,A了再交,输出不是按照时间顺序的。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 struct Data 6 { 7 int id,tot,ti; 8 int pr[30]; 9 void init(int _id)10 {11 id=_id;12 tot=ti=0;13 memset(pr... 阅读全文
posted @ 2012-10-01 20:19 tmeteorj 阅读(293) 评论(0) 推荐(0)
 
POJ 1033
摘要: 题意:磁盘n个块,有m个文件,各自被分割成许多块分散在磁盘之中,要求通过最少移动次数使得第1个文件的占1,2,3...f1块,第二个文件占f1+1,f1+2...f1+f2块。。。题解:dfs(k)为将k位置的文件移到它该去的地方,标记dfs过的点,若发生重复则说明有环,就让当前dfs点移到最大一个空闲块,否则,必定能将链还原。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 const int N=10005; 6 阅读全文
posted @ 2012-10-01 19:43 tmeteorj 阅读(644) 评论(0) 推荐(0)
 
POJ 1156
摘要: 题意:求矩形中差异值最大不超过c的子矩阵的最大面积。题解:枚举子矩形左右两列,然后记录每行位于这两列之间的最大最小值,建两个单调队列,从上往下一次扫描时,判断差异值是否超过了c,以此来维护队列,再加最优化剪枝。View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int N=705;int row,col,c;int map[N][N],_min[N],_max[N];//min/max:第i行[a,b]区间最大/小值int Q1[N*2 阅读全文
posted @ 2012-10-01 18:34 tmeteorj 阅读(390) 评论(0) 推荐(0)
 
 
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 21 下一页

公告


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