自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

QAQ的小耗子的博客

记录下自己的每一步吧

  • 博客(47)
  • 收藏
  • 关注

原创 csp-17-9-2 公共钥匙盒

#include <iostream>#include <cstdio>using namespace std;const int maxn=11000;       //time limitsconst int nummax=1001;int time_In[maxn]={0};int time_Out[maxn][maxn]={0};   //store the key...

2018-05-31 22:07:06 283

原创 树的操作

#include <iostream>#include <cstdio>#include <queue>using namespace std;const int maxn=10001;int data[maxn];struct node{ int data; node* leftchild; node* rightchild;};node *newnode(i...

2018-05-31 22:04:42 247

原创 堆的操作 : 建立堆 ,删除元素,插人元素;

#include <iostream>#include <cstdio>using namespace std;int heap[11]={0,85, 55 , 82 , 57 , 68, 92, 99 ,98 , 66 ,56} ;   //level void downAdjust(int low, int high){  //把每个根结点 和  父结点 进行比较,大的...

2018-05-31 21:19:36 839

原创 patA1023 have fun with numbers (20)

#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn=100001;int hashT[maxn]={0};int hashb[maxn]={0};struct bign{ int d[1...

2018-05-30 20:32:47 179

原创 patA 1096 Consecutive Factors(20)

#include <iostream>#include <cstdio>#include <cmath>using namespace std;int main(int argc, char** argv) { int n; scanf("%d",&n); int len=sqrt(n); int start,max=0; for(int i=2;i&l...

2018-05-30 19:54:09 179

原创 csp-2018-3-2 碰撞的小球

#include <iostream>#include <cstdio>using namespace std;const int maxn=10001;int buf[maxn];bool d[maxn]={false}; //false 表示向右走, true 表示向左走; int book[maxn]={0};int main(in...

2018-05-29 21:12:44 345

原创 csp-2017-12-2 游戏

#include <iostream>#include <cstdio>using namespace std;const int maxn=10001;int   person[maxn]={0};bool  mark[maxn]={true};    //true  :生存   false :死亡 int main(int argc, char** argv) { in...

2018-05-29 21:09:15 1357

原创 patB1070 接绳(25)

#include<bits/stdc++.h>  using namespace std;    int main()  {  //优先队列大的优先      priority_queue<double,vector<double>, greater<double> >ss;//改成小的优先      int n;      double s,xf;...

2018-05-26 17:52:30 170

原创 patB1069 微博转发抽奖(20)

#include <iostream>#include <cstdio> #include <cstring>#include <set>using namespace std;const int maxn=1001;string person[maxn];set<string> SS;int main(int argc, char** ...

2018-05-26 17:50:52 314

原创 patB1068 万绿丛中一点红(20)

#include <iostream>#include <cstdio> using namespace std;const int maxn=510;int buf[maxn][maxn];int main(int argc, char** argv) { int m,n,left,right,v; scanf("%d %d %d %d %d",&m,&n...

2018-05-26 17:49:51 281 1

原创 patB1067 试密码 (20)

#include <iostream>#include <cstdio> using namespace std;const int maxn=510;int buf[maxn][maxn];int main(int argc, char** argv) { int m,n,left,right,v; scanf("%d %d %d %d %d",&m,&n...

2018-05-26 17:48:49 209

原创 patB 1066 图像过滤(15)

#include <iostream>#include <cstdio> using namespace std;const int maxn=510;int buf[maxn][maxn];int main(int argc, char** argv) { int m,n,left,right,v; scanf("%d %d %d %d %d",&m,&n...

2018-05-26 17:47:49 228

原创 patA1078 hashing

#include <iostream>#include <cstdio>#include <cmath>using namespace std;bool hashT[10001]={false};bool isprime(int n){ if(n<=1) return false; int len=(int )sqrt(1.0*n); for(int i ...

2018-05-25 22:35:28 186

原创 patA1015 Reversible Prime(20)

#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn=1000001;//int prime[];bool isprime[maxn]={false};bool S[maxn]={false};int buf[11]={0};void ...

2018-05-24 21:54:31 165

原创 patB1013 数素数

#include <iostream>#include <cstdio>using namespace std;const int maxn=1000001;int prime[maxn];bool isprime[maxn]={false};int primesize=0;void findprime(){ for(int i=2;i<maxn;i++){ if(...

2018-05-24 21:06:12 243

原创 patB 素数对猜想

#include <iostream>#include <stdio.h>bool remark[1000];int prime[1001];int primesize;using namespace std;int main(){    int i,j;    for(i=0;i<=1000;i++){       remark[i]=false;    }    ...

2018-05-23 22:22:56 144

原创 patA1088 Rational Arithmetic

#include <iostream>#include <cstdio>#include <cmath>using namespace std;typedef long long ll;struct fraction{ ll up,down; };ll gcd(ll a,ll b){ return b==0 ? a : gcd(b,a%b);}fraction ...

2018-05-23 22:10:08 151

原创 patA1081 Rational Sum(20)

#include <iostream>#include <cstdio>using namespace std;typedef long long ll;struct fraction{ ll up,down;};int gcd(int a,int b){ return b==0 ? a : gcd(b ,a % b);}fraction reduction(fractio...

2018-05-22 22:21:20 145

原创 patB 1065 单身狗(25)

#include <iostream>#include <cstdio>using namespace std;const int maxn=100001;int couple[maxn];bool mark[maxn];int p_person[maxn];int main(){    int N;    scanf("%d",&N);    for(int i=...

2018-05-20 15:43:05 124

原创 patB 1064朋友数(20)

#include <iostream>#include <cstdio>using namespace std;const int maxn=10001;int num[maxn];int e[maxn]={0};int elen=0;////int resoved(int x){////    int sum=0;////    do{////        sum+=x...

2018-05-20 15:42:03 195

原创 patB 1063 计算谱半径(20)

#include <iostream>#include <cstdio>#include <math.h>using namespace std;int main(){    int n;    scanf("%d",&n);    double maxn=0;    for(int i=0;i<n;i++){        double a,b;...

2018-05-20 15:40:24 135

原创 patb1062 最简分数(20)

#include <iostream>#include <cstdio>using namespace std;int main(){    int x1,y1,x2,y2,down;    scanf("%d/%d %d/%d %d",&x1,&y1,&x2,&y2,&down);    int minnum=x1*down*y2;...

2018-05-20 15:39:16 300

原创 patB1061 判断题(15)

#include <iostream>#include <cstdio>using namespace std;const int maxn=101;int p_value[maxn];int j_p[maxn];int save_s[maxn];int main(){    int N,M;    scanf("%d%d",&N,&M);    for(i...

2018-05-20 15:36:57 202

原创 patA1081 Ration Sum

#include <iostream>#include <cstdio>#include <cmath>using namespace std;const int maxn=100;typedef long long ll;struct Faction{ long long up,down;};Faction f[maxn];long long gcd(long...

2018-05-16 21:42:41 130

原创 如何输出int类型的最大表示范围

#include <iostream>#include <cstdio>using namespace std;const int maxn=0x7fffffff;const int minn=0x80000000;int main(int argc, char** argv) {// int n;// scanf("%d",&n); printf("%d\n%d"...

2018-05-16 20:21:54 3326

原创 patA1008 Elevator

#include <iostream>#include <cstdio>#include <cmath>using namespace std;const int maxn=110;int num[maxn];int main(int argc, char** argv) { int N; scanf("%d",&N); num[0]=0; for(in...

2018-05-15 20:51:11 132

原创 patB1049/patA1104 数列的片段和

#include <iostream>#include <cstdio>using namespace std;const int maxn=100010;double S[maxn];int main(int argc, char** argv) { int N; scanf("%d",&N); for(int i=1;i<=N;i++) scanf("%l...

2018-05-15 20:33:27 299

原创 patA1101/B1045 快速排序(25)

#include <iostream>#include <cstdio>using namespace std;const int maxn=100010;const int INF=0x7fffffff;int S[maxn];int leftmax[maxn];int rightmin[maxn];void init(int n){ int max=0; for(int...

2018-05-14 20:31:27 166

原创 patA1029 Median(25)

#include <iostream>#include <cstdio>using namespace std;const int maxn=1000002;int num1[maxn],num2[maxn];int main(int argc, char** argv) { int n;  scanf("%d",&n); for(int i=1;i<=n;i...

2018-05-14 19:45:24 209

原创 PatA1044 Shopping in Mars(25) 二分优化

1.数据本身没有规律,通过求和后发现递增,这样就可以考虑要用二分法来优化了。#include <iostream>#include <cstdio>using namespace std;const int maxn=100002;int num[maxn],nears=100002;int up_bound(int *a,int sum,int x,int len,int...

2018-05-14 19:14:19 199

原创 patA1044 Shopping in Mars(25) 暴力

#include <iostream>#include <cstdio>using namespace std;const int maxn=100001;int num[maxn];int main(int argc, char** argv) { int n,pay; scanf("%d%d",&n,&pay); for(int i=0;i<n;i...

2018-05-13 22:25:22 183

原创 patA1085 完美数列 upper_bound()

#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn=100001;int num[maxn];int main(int argc, char** argv) { int n,p; scanf("%d%d",&n,&p)...

2018-05-11 21:20:26 163

原创 patA1085 完美数列(25)

注意点:int*int 最大值可能达到10^18暴力解决的时间复杂度肯定超时。#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn=100001;int num[maxn];int binarySearch(int i,int n,lo...

2018-05-11 20:45:43 196

原创 patB1030/patA1085 完美数列

#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn=100001;int num[maxn];int main(int argc, char** argv) { int n,p; scanf("%d%d",&n,&p)...

2018-05-09 22:07:29 204

原创 patA1038 Recover the Smallest Number

using namespace std;const int maxn=10001;string str[maxn];//bool cmp(string a,string b){// return a<b;//}int main(int argc, char** argv) { int n; cin>>n; for(int i=0;i<n;i++) cin>>st...

2018-05-09 21:50:01 156

原创 patA1067 Sort with Swap(0,*)

#include <iostream>#include <cstdio> #include <algorithm>using namespace std;const int maxn=100001;int num[maxn];       //目标数组;int op[maxn];        //操作的数组; bool place[maxn];   //对应的...

2018-05-08 21:32:36 166

原创 patA1037 Magic Coupon

#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn=100001;int c[maxn],p[maxn];bool cmp(int a,int b){ return a>b;}int main(int argc, char** ...

2018-05-08 20:21:13 129

原创 patA1033 to fill or not fill

#include <iostream>#include <cstdio>#include <algorithm>using namespace std;//在汽车的行驶过程中,如果有更便宜的,选择便宜的,加一定量。去下一个更便宜的。 //有没有必要计算俩个加油点的距离?//又没有必要对距离原点的距离进行排序? struct postion{ double per...

2018-05-06 13:31:05 183

原创 patB1020 月饼

#include <iostream>#include <cstdio> #include <algorithm>using namespace std;struct mooncake{ double num; double m; double p;  //单位重量上价值量最大的; bool operator < (const mooncake &...

2018-05-04 21:49:22 205

原创 patA1048 Find coins 用散列进行优化

#include <iostream>#include <cstdio> using namespace std;const int maxn=10001;int hashT[maxn]={0};int main(int argc, char** argv) { int n,m; scanf("%d %d",&n,&m); for(int i=0;i<...

2018-05-03 15:37:59 171

空空如也

空空如也

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

TA关注的人

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