Skip to content

Commit ec7dfca

Browse files
committed
First commit
0 parents  commit ec7dfca

File tree

2,174 files changed

+545078
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,174 files changed

+545078
-0
lines changed

.vscode/launch.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
// Use IntelliSense to learn about possible Node.js debug attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Launch Program",
11+
"program": "${workspaceRoot}/app.js",
12+
"cwd": "${workspaceRoot}"
13+
},
14+
{
15+
"type": "node",
16+
"request": "attach",
17+
"name": "Attach to Process",
18+
"port": 5858
19+
}
20+
]
21+
}

10月16 练习/A.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include<bits/stdc++.h>
2+
3+
int main(void)
4+
{
5+
6+
return 0;
7+
}

10月16 练习/F.c

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#include <cstdio>
2+
#include <vector>
3+
#include <algorithm>
4+
5+
using namespace std;
6+
7+
typedef long long ll;
8+
9+
#define NMAX 1100
10+
11+
struct xp{
12+
int c,p;
13+
bool operator < (const xp &b)const{
14+
return (p==b.p)?(c<b.c):(p>b.p);
15+
}
16+
};
17+
18+
struct ad{
19+
vector<xp> x;
20+
21+
void s(){sort(x.begin(),x.end());}
22+
bool operator < (const ad &b)const{
23+
(x[0].p==b.x[0].p)?(x[0].c<b.x[0].c):(x[0].p<b.x[0].p);
24+
}
25+
};
26+
27+
struct mu{
28+
vector<ad> f;
29+
30+
void s(){
31+
int ne=f.size(),i;
32+
for(i=0;i<ne;i++)f[i].s();
33+
sort(f.begin(),f.end());
34+
}
35+
};
36+
37+
void gen(int n,bool b,int op,mu &p){
38+
if(b){
39+
if(n%2){
40+
ad a;
41+
a.x.push_back((xp){1,1});
42+
a.x.push_back((xp){-1,0});
43+
p.f.push_back(a);
44+
a.x.clear();
45+
for(i=n-1;i>=0;i--)
46+
a.x.push_back((xp){((i%2)?-1:1),i});
47+
p.f.push_back(a);
48+
}else{
49+
int q,num=0;
50+
int i;
51+
for(q=n;!(q%2);q/=2)num++;
52+
gen(q,true,num*op,p);
53+
}
54+
}else{
55+
if(n%2){
56+
ad a;
57+
a.x.push_back((xp){1,1});
58+
a.x.push_back((xp){-1,0});
59+
p.f.push_back(a);
60+
a.x.clear();
61+
for(i=n-1;i>=0;i--)
62+
a.x.push_back((xp){1,i});
63+
p.f.push_back(a);
64+
}else{
65+
gen(n/2,true,op,p);
66+
}
67+
}
68+
p.s();
69+
}
70+
71+
mu p;
72+
73+
int main(){
74+
int n;
75+
int i,j;
76+
77+
while(true){
78+
scanf("%d",&n);
79+
if(n==0)break;
80+
gen(n,false,1,p);
81+
for(i=0;i<p.x.size();i++){
82+
vector<xp> &x=p.f[i].x;
83+
for(j=0;j<x.size();j++){
84+
if(x[j].c>0)putchar('+');
85+
else putchar('-');
86+
printf("%d ",x[j].p);
87+
}
88+
putchar('\n');
89+
}
90+
p.f.clear();
91+
}
92+
}

10月16 练习/F.cpp

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#include <cstdio>
2+
#include <vector>
3+
#include <algorithm>
4+
5+
using namespace std;
6+
7+
typedef long long ll;
8+
9+
#define NMAX 1100
10+
11+
struct xp{
12+
int c,p;
13+
bool operator < (const xp &b)const{
14+
return (p==b.p)?(c<b.c):(p>b.p);
15+
}
16+
};
17+
18+
struct ad{
19+
vector<xp> x;
20+
21+
void s(){sort(x.begin(),x.end());}
22+
bool operator < (const ad &b)const{
23+
if(x[0].p!=b.x[0].p)return x[0].p<b.x[0].p;
24+
//if(x.size()!=b.x.size())return x.size()<b.x.size();
25+
int i;
26+
for(i=0;i<x.size();i++)
27+
if(x[i].c!=b.x[i].c)return x[i].c<b.x[i].c;
28+
}
29+
};
30+
31+
struct mu{
32+
vector<ad> f;
33+
34+
void s(){
35+
int ne=f.size();
36+
int i;
37+
for(i=0;i<ne;i++)f[i].s();
38+
sort(f.begin(),f.end());
39+
}
40+
};
41+
42+
void gen(int n,bool b,int op,mu &p){
43+
if(b){
44+
if(n%2){
45+
ad a;
46+
int i;
47+
48+
a.x.push_back((xp){1,op});
49+
a.x.push_back((xp){1,0});
50+
p.f.push_back(a);
51+
a.x.clear();
52+
for(i=n-1;i>=0;i--)
53+
a.x.push_back((xp){((i%2)?-1:1),i*op});
54+
p.f.push_back(a);
55+
}else{
56+
int q,ndq;
57+
for(q=n;!(q%2);q/=2);
58+
ndq=n/q;
59+
gen(q,true,ndq*op,p);
60+
}
61+
}else{
62+
if(n%2){
63+
ad a;
64+
int i;
65+
66+
a.x.push_back((xp){1,op});
67+
a.x.push_back((xp){-1,0});
68+
p.f.push_back(a);
69+
a.x.clear();
70+
for(i=n-1;i>=0;i--)
71+
a.x.push_back((xp){1,i*op});
72+
p.f.push_back(a);
73+
}else{
74+
gen(n/2,true,op,p);
75+
gen(n/2,false,op,p);
76+
}
77+
}
78+
}
79+
80+
int n;
81+
mu p;
82+
83+
void output(){
84+
int i,j;
85+
86+
p.s();
87+
int sp=p.f.size();
88+
for(i=0;i<sp;i++){
89+
vector<xp> &x=p.f[i].x;
90+
int sx=x.size();
91+
92+
if(x[0].p==0)continue;
93+
if(n!=1)putchar('(');
94+
95+
for(j=0;j<sx;j++){
96+
if(j!=0&&x[j].c>0)putchar('+');
97+
if(x[j].c<0)putchar('-');
98+
99+
if(x[j].p==0)putchar('1');
100+
else if(x[j].p==1)putchar('x');
101+
else{
102+
printf("x^%d",x[j].p);
103+
}
104+
}
105+
if(n!=1)putchar(')');
106+
}
107+
putchar('\n');
108+
}
109+
110+
int main(){
111+
int i,j;
112+
113+
//freopen("f.out","w",stdout);
114+
115+
while(true){
116+
scanf("%d",&n);
117+
if(n==0)break;
118+
gen(n,false,1,p);
119+
output();
120+
p.f.clear();
121+
}
122+
}

10月16 练习/F.exe

298 KB
Binary file not shown.

10月16 练习/F.o

102 KB
Binary file not shown.

10月16 练习/I.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include<bits/stdc++.h>
2+
3+
int main(void)
4+
{
5+
int n;
6+
int tmp,s;
7+
int i;
8+
9+
while(true){
10+
scanf("%d",&n);
11+
if(n==0)break;
12+
s=0;
13+
for(i=0;i<n;i++){
14+
scanf("%d",&tmp);
15+
s+=tmp*tmp;
16+
}
17+
printf("%d\n",s);
18+
}
19+
return 0;
20+
}

10月16 练习/I.exe

937 KB
Binary file not shown.

10月16 练习/I.o

3.71 KB
Binary file not shown.

10月16 练习/J.cpp

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#include<bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
#define NMAX 1000
6+
#define LMAX 100
7+
8+
char str[2][LMAX+10];
9+
vector<int> c[NMAX+10];
10+
int d[NMAX+10];
11+
12+
int main(void)
13+
{
14+
int n=0,m,k,p;
15+
int tmp1,tmp2;
16+
int s;
17+
int i,j;
18+
int ne,pc;
19+
20+
while(true){
21+
memset(d,0,sizeof(d));
22+
for(i=0;i<=n;i++)c[i].clear();
23+
scanf("%d%d%d",&n,&m,&k);
24+
if(n==0&&m==0&&k==0)break;
25+
scanf("%d",&p);
26+
for(i=0;i<p;i++){
27+
scanf("%s%d%s%d",str[0],&tmp1,str[1],&tmp2);
28+
if(str[0][0]=='c')c[tmp1].push_back(tmp2);
29+
else d[tmp1]++;
30+
}
31+
for(i=1;i<=n;i++)sort(c[i].begin(),c[i].end());
32+
s=0;
33+
for(i=1;i<=n;i++){
34+
ne=c[i].size();
35+
pc=0;
36+
for(j=1;j<=m;j++){
37+
if(pc<ne&&c[i][pc]==j){
38+
pc++;
39+
continue;
40+
}
41+
s+=k-d[j];
42+
}
43+
}
44+
printf("%d\n",s);
45+
}
46+
return 0;
47+
}

10月16 练习/J.exe

964 KB
Binary file not shown.

10月16 练习/J.o

43.7 KB
Binary file not shown.

10月16 练习/K.c

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

10月16 练习/K.cpp

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <cstdio>
2+
3+
using namespace std;
4+
5+
typedef long long ll;
6+
7+
int n;
8+
9+
struct rab{
10+
int d0,v,it;
11+
};
12+
13+
rab r[2];
14+
char str[10];
15+
16+
int ctod(char c){
17+
switch(c){
18+
case 'E':return 0;
19+
case 'N':return 1;
20+
case 'W':return 2;
21+
case 'S':return 3;
22+
}
23+
}
24+
25+
struct pos{
26+
int x,y;
27+
};
28+
29+
struct cond{
30+
int t;
31+
pos p[2];
32+
33+
cond next()const{
34+
int
35+
}
36+
};
37+
38+
int main(){
39+
int n,k;
40+
cond tc;
41+
int i;
42+
43+
while(true){
44+
scanf("%d",&n);
45+
for(i=0;i<2;i++){
46+
scanf("%s%d%d",str,&rab[i].v,&rab[i].it);
47+
rab[i].d0=ctod(str[0]);
48+
}
49+
scanf("%d",&k);
50+
tc.t=0;
51+
for(i=0;i<k;i++)tc=tc.next();
52+
}
53+
}

10月16 练习/f-comp.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <cstdio>
2+
3+
using namespace std;
4+
5+
int main(){
6+
int i;
7+
8+
for(i=1;i<=1100;i++){
9+
printf("%d\n",i);
10+
}
11+
printf("0\n");
12+
return 0;
13+
}

10月16 练习/f-comp.exe

67.4 KB
Binary file not shown.

10月16 练习/f-comp.o

769 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)