自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

[Q]4EchoNStef

没人能逼着你刷题,更没人能阻止你刷题

  • 博客(28)
  • 资源 (1)
  • 收藏
  • 关注

转载 什么是离散化?

如果说今年这时候OIBH问得最多的问题是二分图,那么去年这时候问得最多的算是离散化了。对于“什么是离散化”,搜索帖子你会发现有各种说法,比如“排序后处理”、“对坐标的近似处理”等等。哪个是对的呢?哪个都对。关键在于,这需要一些例子和不少的讲解才能完全解释清楚。    离散化是程序设计中一个非常常用的技巧,它可以有效的降低时间复杂度。其基本思想就是在众多可能的情况中“只考虑我需要用的值”。下面我

2012-02-29 11:13:16 573

原创 1085.Longge's problem (数论,欧拉积性函数)

Longge's problem Time Limit:1000MS   Memory Limit:65536KTotal Submit:1156 Accepted:308DescriptionLongge is good at mathematics and he likes to think about hard mathematical problems which wi

2012-02-29 10:45:02 1913 1

转载 1034. Forest

1034. ForestTime Limit: 1sec    Memory Limit:32MBDescriptionIn the field of computer science, forest is important and deeply researched , it is a model for many data structures . Now it’s yo

2012-02-29 00:03:24 1338

转载 Sicily 1033 City Road (递推)

//模拟+递推,感觉这种题不能称之为动态规划,只能叫递推因为每个点只调用了一次,不存在所谓的转移//题意是从起点到终点,有多少种不同的走法,图中有些路有障碍//注意到规模是M*N <= 1000000,所以直接模拟就得了,数组嘛不能开成二维的会MLE//把二维的坐标转化成1维的,这样就开的下了,数组的每个位存放的是十字路口的点,记录走到当前点有多少种不同的走法//X,Y这两个BOOL型数组

2012-02-28 21:57:54 584

原创 1028. Hanoi Tower Sequence (高精,除2)

思路:设第n个数为k,则该序列的结构为:。。。。。。。。。。。。。。。o。。。。。。。。。。。。。。2^(k-1)-1个数                                 数字k                  2^(k-1)-1个数 因此2^(k-1)-1+1=n,即     2^(k-1)=n;因此,输入n,只要判断n被2整除的次数,再+1即得结果.

2012-02-28 01:00:36 1576

原创 1017. Rate of Return

二分。#include #include #include using namespace std;int main(){ int t,mark=1; double month[20],money[20],lastMonth,lastMoney; while(cin>>t&&t!=-1) { for(int z=1;z<=t;z++) cin>>m

2012-02-25 17:01:30 800

原创 1012. Stacking Cylinders (几何题)

分析图,由等腰三角形的性质,依次把sqrt(2^2-((xi-xj)/2)^2)相加可得到y, 其中j=i+1. 注意要先对输入的数据排序.#include #include #include #include using namespace std;int main(){ int t; while(cin>>t&&t) { double arr[11],y=1

2012-02-25 14:22:55 865

原创 1011. Lenny's Lucky Lott (dp)

设dp[i][j]为选取的第i个数为j的方案数dp[i][j] = sum(dp[i-1][k]), i-1 #include #include using namespace std;long long dp[15][2005];int main(){ int t,n,m; cin>>t; for(int z=1;z<=t;z++)

2012-02-25 11:18:42 548

原创 1010. Zipper (dp)

soj.me/1010dp[i][j]=    dp[i-1][j] && C[i+j-1]==A[i-1]    ||      dp[i][j-1] && C[i+j-1]==B[j-1]; #include #include #include using namespace std;bool dp[201][201];int main(){ int t; cin

2012-02-24 20:08:14 645

原创 1009. Mersenne Composite N

soj.me/1009k为质数,2^k-1是合数的话,求出该合数的因子,水.#include #include using namespace std;bool prime(int a){ for(int i=2;i*i<=a;i++) if(a%i==0) return false; return true;}int main(){ int t;

2012-02-23 22:23:17 1016

原创 1002. Anti-prime Sequences

回溯,dfs,超时了好多次,,参考了百度#include #include using namespace std;int n,m,d,arr[1002],vis[1002]; //arr储存答案,vis记录是否访问过某位置bool b;//判断答案是否存在bool prime(int x){ for(int i=2;i*i<=x;++i) if

2012-02-22 20:10:26 1171

原创 1004. I Conduit!

soj.me/1004依次排序好k,b,x1,y1注意斜率不存在的情况#include #include #include using namespace std;const double MAX=999999;//自定义无穷大斜率class segment{public: double k,b,x1,y1,x2,y2;//使用斜截式表示线段

2012-02-22 17:02:53 1619 2

原创 1002. 猴子选大王(Version 2)

1002. 猴子选大王(Version 2)        Time Limit: 1sec    Memory Limit:256MBDescription猴子选大王,有N只猴子,从1~N进行编号。它们按照编号的顺时针方向,排成一个圆

2012-02-21 01:14:35 2232

原创 1005. 中缀表达式转后缀表达式

1005. 中缀表达式转后缀表达式     Time Limit: 1sec    Memory Limit:256MBDescription将中缀表达式(infix expression)转换为后缀表达式(postfix expression)。假设中缀表达式中的操

2012-02-20 21:12:40 1330

原创 1282. Computer Game

soj.me/1282字符串匹配的KMP算法参考http://www.cnblogs.com/mjc467621163/archive/2011/07/16/2108423.html和http://zh.wikipedia.org/wiki/%E5%85%8B%E5%8A%AA%E6%96%AF-%E8%8E%AB%E9%87%8C%E6%96%AF-%E6%99%AE%E6%8B%8

2012-02-20 14:23:01 737

原创 1003. Hit or Miss

1003. Hit or Miss     Time Limit: 1sec    Memory Limit:32MBDescriptionOne very simple type of solitaire game known as "Hit or Miss" (a

2012-02-20 00:56:07 1856 1

原创 1129. ISBN

soj.me/1129#include #include using namespace std;int main(){ string str; while(cin>>str) { int len=str.length(); int mark=10,sum=0; for(int i=0;i<len;i++) { if(str[i]=='-') co

2012-02-19 00:01:06 1021 1

原创 1155. Can I Post the lette

soj.me/1155#include #include using namespace std;int n,m,t1,t2;bool canreach[210][210];//两城市之间可联通bool hasde[210];//是否访问过该城市void dfs(int t){ hasde[t] = true; for(int i = 0; i < n; i++)

2012-02-18 23:37:53 1105

原创 1782. Knapsack

soj.me/1782// Problem#: 1782// Submission#: 1211799// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License// URI: http://creativecommon

2012-02-18 22:06:06 684

原创 1752. 选择

soj.me/1725#include #include using namespace std;int p[5001],arr[1000001],n;int prime(){ memset(arr,0,sizeof(arr)); int k=1; for(int i=2;i<1000000;i++) { if(arr[i]==0) {

2012-02-18 00:14:35 733

原创 2014. Dairy Queen

soj.me/2014动态规划// Problem#: 2014// Submission#: 1211589// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License// URI: http://creativecomm

2012-02-17 23:51:59 1036

原创 1825. Nickname

soj.me/1825// Problem#: 1825// Submission#: 1211578// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License// URI: http://creativeco

2012-02-17 23:03:54 809 1

原创 1587. Eat or Be Eaten

soj.me/1587#include #include #include using namespace std;int a[20001],b[20001];int cmp(int a,int b){ return a<b;}int f(int min,int max,int t){ int mid=(min+max)/2; if(b[max-1]<t) r

2012-02-17 11:31:56 824

原创 1156. Binary tree

http://soj.me/1156 #include //给出一棵二叉树,输出前序遍历序列#includeusing namespace std;struct node{ char c; int l,r;}tree[1010];int vis[1010],rt[1010];//vis[i]决定是否访问,rt[i]=0说明“上头有人”

2012-02-14 11:20:38 896

原创 1325. Digit Generator

soj.me/1325 #include #include #include using namespace std;int main(){ int t; cin>>t; while(t--) { char a[10001]; cin>>a; int num=atoi(a)

2012-02-14 10:21:59 881

原创 1240.Faulty Odometer

//把一个9进制数转换成10进制//不过这个9进制数的数字是0 1 2 3 5 6 7 8 9,就是没有4//把4之后的数都减一,然后就是真正的9进制数//“1399” = 1388(9) = 1052(10)//“1500” = 1400(9) = 1053(10)//因此把数字转成标准9进制,再转成10进制就OK了#include#include#inclu

2012-02-12 12:53:11 1193

原创 1625. Binary Clock

http://soj.me/1625#include #include using namespace std;void f(int ver[6][3],int hor[3][6],int i,int number)//i=0,1,2分别表示hour,minute,second{ int k=5; while(number!=0) { ver[k][i]=number%

2012-02-05 21:51:09 556

原创 1530. The Seven Percent Solution

http://soj.me/show_problem.php?pid=1530#include #include #include using namespace std;bool check(char c){if(c==' '||c=='!'||c=='$'||c=='%'||c=='('||c==')'||c=='*')return true

2012-02-05 21:18:27 768

Socket(C++,基于TCP)在线实时聊天程序

Socket(C++,基于TCP)在线实时聊天程序

2013-03-11

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除