Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0456030

Browse filesBrowse files
committed
add
1 parent 79cbc72 commit 0456030
Copy full SHA for 0456030

16 files changed

+561Lines changed: 561 additions & 0 deletions
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lwh/7/1001/105924.txt‎

Copy file name to clipboardExpand all lines: lwh/7/1001/105924.txt
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include<stdio.h>
2+
int main()
3+
{
4+
printf("Hello World!\n");
5+
return 0;
6+
}
Collapse file

‎lwh/7/1001/106776.txt‎

Copy file name to clipboardExpand all lines: lwh/7/1001/106776.txt
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include<stdio.h>
2+
int main()
3+
{
4+
printf("Hello World\n");
5+
}
Collapse file

‎lwh/7/1001/281061.txt‎

Copy file name to clipboardExpand all lines: lwh/7/1001/281061.txt
+97Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*先遍历一遍,用两个变量记录出现连续两个数字出现的次数,
2+
依次更迭替换最大值,并用一个数组来记录
3+
*/
4+
#include<stdio.h>
5+
6+
int main()
7+
{
8+
freopen("test.txt","r",stdin);
9+
int N,b[1002],max=0,a,temp,q,k=0;//max记录
10+
scanf("%d",&N);
11+
for(int i=0;i<N;i++)
12+
scanf("%d",&b[i]);//写入牛的品种信息到数组b[i]中;
13+
14+
15+
if(N==1)
16+
printf("%d\n",1);
17+
18+
if(N==2)
19+
{
20+
if(b[0]==b[1])
21+
printf("%d\n",2);
22+
else printf("%d\n",1);
23+
}
24+
else if(N>=3)
25+
{
26+
27+
int i=1;
28+
int count;
29+
if(b[0]==b[1])
30+
{
31+
for(int w=0;w<N;w++)
32+
{
33+
if(b[w]==b[0])
34+
k++;
35+
//printf("%d\n",k);
36+
if(b[w]!=b[0])
37+
break;
38+
}
39+
k=a[0];
40+
41+
}
42+
else if(b[N-1]==b[N-2])
43+
{
44+
for(int w=N-1;;w--)
45+
{
46+
if(b[w]==b[N-1])
47+
k++;
48+
else if(b[w]!=b[N-1]||w<0)
49+
break;
50+
}
51+
k=a[1];
52+
53+
}
54+
while(i<N-1)
55+
{
56+
q=0;
57+
count=0;
58+
//if()
59+
if(b[i-1]==b[i+1])
60+
{
61+
temp=b[i];
62+
for(int j=i-1;;)
63+
{
64+
if(b[j]==b[i-1]||b[j]==temp)
65+
{
66+
count++;
67+
if(b[j]==temp&&temp!=b[i-1])
68+
q++;
69+
}
70+
else //if((b[j]!=b[i-1]&&b[j]!=temp)&&j>N-1)
71+
break;
72+
73+
j++;
74+
75+
}
76+
count=count-q;
77+
if(count>max)
78+
{
79+
max=count;
80+
k=max;
81+
// printf("count=%d max=%d\n",count,max);
82+
}
83+
}
84+
i++;
85+
86+
}
87+
k=a[2];
88+
for(int l=0;l<3;l++)
89+
{
90+
if(a[2]>a[1]&&a[2]>a[0])
91+
printf("%d\n",a[2]);
92+
else if(a[2]>)
93+
}
94+
95+
}
96+
97+
}
Collapse file

‎lwh/7/1001/313160.txt‎

Copy file name to clipboardExpand all lines: lwh/7/1001/313160.txt
+193Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
#include <cstdio>
2+
#include <cstring>
3+
#include <iostream>
4+
int next1[3][2]={{1,0},{0,-1},{-1,0}};
5+
int next2[3][2]={{0,-1},{-1,0},{0,1}};
6+
int next3[3][2]={{-1,0},{0,1},{1,0}};
7+
int next4[3][2]={{0,1},{1,0},{0,-1}};
8+
int route[101][2];
9+
int judge_x,judge_y;
10+
int book[102][102];
11+
char map[102][102];
12+
int v;
13+
void dfs(int x,int y,int dir);
14+
int main()
15+
{
16+
int n,m;
17+
while(scanf("%d %d",&n,&m)!=EOF)
18+
{
19+
if(n==0&&m==0)
20+
return 0;
21+
memset(book,0,sizeof(book));
22+
int startx,starty,endx,endy;
23+
for(int i=0;i<n;i++)
24+
scanf("%s",map[i]);//输入地图
25+
v=0;
26+
// printf("%c\n",map[2][3]);
27+
for(int i=0;i<n;i++)
28+
{
29+
for(int j=0;j<m;j++)
30+
{
31+
if(map[i][j]=='S')
32+
{
33+
startx=i;
34+
starty=j;
35+
// printf("i=%d j=%d\n",i,j);
36+
}
37+
38+
}
39+
}
40+
//printf("startx=%d starty=%d\n",startx,starty);//记录入口与出口的坐标
41+
route[v][0]=startx;route[v][1]=starty;
42+
v++;
43+
int direct;//direct=1表示向左,2表示向前,3表示向右,4表示向下
44+
//找出第一步可行的方向,传入dfs函数中
45+
if(map[startx][starty-1]=='.'||map[startx][starty-1]=='E')
46+
{
47+
book[startx][starty]=1;
48+
dfs(startx,starty,0);
49+
}
50+
else if(map[startx-1][starty]=='.'||map[startx][starty-1]=='E')
51+
{
52+
book[startx][starty]=1;
53+
dfs(startx,starty,1);
54+
}
55+
else if(map[startx][starty+1]=='.'||map[startx][starty-1]=='E')
56+
{
57+
book[startx][starty]=1;
58+
dfs(startx,starty,2);
59+
}
60+
else if(map[startx+1][starty]=='.'||map[startx][starty-1]=='E')
61+
{
62+
book[startx][starty]=1;
63+
dfs(startx,starty,3);
64+
}
65+
66+
}
67+
}
68+
void dfs(int x,int y,int dir)
69+
{
70+
int last_step_x=x,last_step_y=y;
71+
printf("x=%d y=%d dir=%d map[%d][%d]=%c\n",x,y,dir,x,y,map[x][y]);
72+
73+
if(map[x][y]=='E')
74+
{
75+
for(int i=0;i<v;i++)
76+
printf("%d %d\n",route[i][0]+1,route[i][1]+1);
77+
return;
78+
}
79+
for(int i=0;i<3;i++)
80+
{
81+
if(dir==0)
82+
{
83+
int cmpx=x+next1[i][0],cmpy=y+next1[i][1];
84+
if(cmpx<0||cmpy<0||map[cmpx][cmpy]=='#')
85+
continue;
86+
x+=next1[i][0];
87+
y+=next1[i][1];
88+
if(book[x][y]==1)
89+
return;
90+
judge_x=x-last_step_x;
91+
judge_y=y-last_step_y;
92+
if(judge_x==0&&judge_y==-1)
93+
dir=0;
94+
else if(judge_x==-1&&judge_y==0)
95+
dir=1;
96+
else if(judge_x==0&&judge_y==1)
97+
dir=2;
98+
else if(judge_x==1&&judge_y==0)
99+
dir=3;
100+
// printf("i=%d x=%d y=%d dir=%d map[%d][%d]=%c\n",i,x,y,dir,x,y,map[x][y]);
101+
book[x][y]=1;
102+
route[v][0]=x;
103+
route[v][1]=y;
104+
v++;
105+
dfs(x,y,dir);
106+
book[x][y]=0;
107+
}
108+
else if(dir==1)
109+
{
110+
int cmpx=x+next2[i][0],cmpy=y+next2[i][1];
111+
if(cmpx<0||cmpy<0||map[cmpx][cmpy]=='#')
112+
continue;
113+
x+=next2[i][0];
114+
y+=next2[i][1];
115+
if(book[x][y]==1)
116+
return;
117+
judge_x=x-last_step_x;
118+
judge_y=y-last_step_y;
119+
if(judge_x==0&&judge_y==-1)
120+
dir=0;
121+
else if(judge_x==-1&&judge_y==0)
122+
dir=1;
123+
else if(judge_x==0&&judge_y==1)
124+
dir=2;
125+
else if(judge_x==1&&judge_y==0)
126+
dir=3;
127+
// printf("i=%d x=%d y=%d dir=%d map[%d][%d]=%c\n",i,x,y,dir,x,y,map[x][y]);
128+
book[x][y]=1;
129+
route[v][0]=x;
130+
route[v][1]=y;
131+
v++;
132+
dfs(x,y,dir);
133+
book[x][y]=0;
134+
135+
}
136+
else if(dir==2)
137+
{
138+
int cmpx=x+next3[i][0],cmpy=y+next3[i][1];
139+
if(cmpx<0||cmpy<0||map[cmpx][cmpy]=='#')
140+
continue;
141+
x+=next3[i][0];
142+
y+=next3[i][1];
143+
if(book[x][y]==1)
144+
return;
145+
judge_x=x-last_step_x;
146+
judge_y=y-last_step_y;
147+
if(judge_x==0&&judge_y==-1)
148+
dir=0;
149+
else if(judge_x==-1&&judge_y==0)
150+
dir=1;
151+
else if(judge_x==0&&judge_y==1)
152+
dir=2;
153+
else if(judge_x==1&&judge_y==0)
154+
dir=3;
155+
// printf("i=%d x=%d y=%d dir=%d map[%d][%d]=%c\n",i,x,y,dir,x,y,map[x][y]); book[x][y]=1;
156+
book[x][y]=1;
157+
route[v][0]=x;
158+
route[v][1]=y;
159+
v++;
160+
dfs(x,y,dir);
161+
book[x][y]=0;
162+
}
163+
else if(dir==3)
164+
{
165+
int cmpx=x+next4[i][0],cmpy=y+next4[i][1];
166+
if(cmpx<0||cmpy<0||map[cmpx][cmpy]=='#')
167+
continue;
168+
x+=next4[i][0];
169+
y+=next4[i][1];
170+
if(book[x][y]==1)
171+
return;
172+
judge_x=x-last_step_x;
173+
judge_y=y-last_step_y;
174+
if(judge_x==0&&judge_y==-1)
175+
dir=0;
176+
else if(judge_x==-1&&judge_y==0)
177+
dir=1;
178+
else if(judge_x==0&&judge_y==1)
179+
dir=2;
180+
else if(judge_x==1&&judge_y==0)
181+
dir=3;
182+
// printf("i=%d x=%d y=%d dir=%d map[%d][%d]=%c\n",i,x,y,dir,x,y,map[x][y]);
183+
book[x][y]=1;
184+
route[v][0]=x;
185+
route[v][1]=y;
186+
v++;
187+
dfs(x,y,dir);
188+
book[x][y]=0;
189+
}
190+
//book[x][y]=0;
191+
}
192+
return;
193+
}
Collapse file

‎lwh/7/1001/322586.txt‎

Copy file name to clipboardExpand all lines: lwh/7/1001/322586.txt
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
program Main;
2+
begin
3+
writeln(' Hello,World! ');
4+
writeln(' ');
5+
end.
Collapse file

‎lwh/7/1001/322587.txt‎

Copy file name to clipboardExpand all lines: lwh/7/1001/322587.txt
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
program Main;
2+
begin
3+
writeln('Hello,World!');
4+
writeln(' ');
5+
end.
Collapse file

‎lwh/7/1001/322588.txt‎

Copy file name to clipboardExpand all lines: lwh/7/1001/322588.txt
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
program Main;
2+
begin
3+
writeln('Hello,World!');
4+
writeln(' ');
5+
end.
Collapse file

‎lwh/7/1001/322589.txt‎

Copy file name to clipboardExpand all lines: lwh/7/1001/322589.txt
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
program Main;
2+
begin
3+
writeln('Hello,World!');
4+
end.
Collapse file

‎lwh/7/1001/322590.txt‎

Copy file name to clipboardExpand all lines: lwh/7/1001/322590.txt
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
program Main;
2+
begin
3+
writeln('Hello World!');
4+
end.
Collapse file

‎lwh/7/1001/327173.txt‎

Copy file name to clipboardExpand all lines: lwh/7/1001/327173.txt
+51Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#include <iostream>
2+
#include <algorithm>
3+
using namespace std;
4+
int ans = 0,T;
5+
bool book[30];
6+
struct R {
7+
int num;
8+
bool op;
9+
}N[30];
10+
void DFS(int END)
11+
{
12+
//cout << END << endl;
13+
if(END == 1) {
14+
int sum = 0;
15+
for(int k=1; k<=T-1; k++) {
16+
if(N[k].op == true) {
17+
sum += N[k].num;
18+
}
19+
else if(N[k].op == false) {
20+
sum -= N[k].num;
21+
}
22+
}
23+
if(sum == T)
24+
ans++;
25+
//cout << "b" << endl;
26+
return;
27+
}
28+
for(int i=1; i<T; i++) {
29+
for(int j=1; j<=2; j++) {
30+
if(j==1)
31+
N[i].op = true;
32+
else
33+
N[i].op = false;
34+
//cout << "a" << endl;
35+
DFS(END-1);
36+
}
37+
}
38+
return;
39+
}
40+
int main()
41+
{
42+
cin >> T;
43+
//cout << T;
44+
for(int i=1; i<T; i++) {
45+
N[i].num = i;
46+
book[i] = true;
47+
}
48+
DFS(T);
49+
cout<<ans<<endl;
50+
51+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.