This commit is contained in:
James 2020-05-02 19:13:13 +08:00
parent a543f8bc0d
commit c9ee67e788
10 changed files with 108 additions and 0 deletions

54
2861_baochui/main.cpp Normal file
View File

@ -0,0 +1,54 @@
#include <iostream>
using namespace std;
int main()
{
int n,longa,longb;
int a[101]={0},b[101]={0};
cin>>n>>longa>>longb;
for(int i=1;i<=longa;i++){
cin>>a[i];
}
for(int i=1;i<=longb;i++){
cin>>b[i];
}
int nowa=0,nowb=0;
int ans=0;
for(int i=1;i<=n;i++){
nowa++;
nowb++;
if(nowa>longa){
nowa=1;
}
if(nowb>longb){
nowb=1;
}
int yi=a[nowa],er=b[nowb];
if(yi==0&&er==2){
ans++;
}
if(yi==2&&er==5){
ans++;
}
if(yi==5&&er==0){
ans++;
}
if(er==0&&yi==2){
ans--;
}
if(er==2&&yi==5){
ans--;
}
if(er==5&&yi==0){
ans--;
}
}
if(ans==0){
cout<<"draw";
}else{
if(ans>0){
cout<<"A";
}else{
cout<<"B";
}
}
}

3
2865_deletenum/Readme.md Normal file
View File

@ -0,0 +1,3 @@
# 标题
* 内容

View File

@ -0,0 +1 @@
#

Binary file not shown.

26
2865_deletenum/main.cpp Normal file
View File

@ -0,0 +1,26 @@
#include <iostream>
using namespace std;
int maxs(int yi,int er){
return yi>er? yi:er;
}
int main()
{
int n,a[101]={0};
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
int f[101]={0};
for(int i=1;i<=n;i++){
f[i]=f[i-1]+a[i];
for(int j=1;j<=n-2;j++){
int now=a[i]-a[j];
if(now<0){
now*=-1;
}
now=now*(i-j+1);
f[i]=maxs(f[i],f[j-1]+now);
}
}
cout<<f[n];
}

BIN
2865_deletenum/main.exe Normal file

Binary file not shown.

View File

@ -0,0 +1,2 @@
17
55 200 199 151 194 135 41 37 132 93 188 12 7 119 148 100 66

View File

@ -0,0 +1,2 @@
40
11 139 177 146 141 124 121 58 120 73 92 15 184 41 53 166 158 75 27 159 122 109 112 74 200 116 171 8 114 13 55 81 194 47 102 165 56 130 9 95

View File

@ -0,0 +1,2 @@
50
57 110 34 18 159 114 128 857 141 171 121 161 109 116 52 152 19 103 174 37 1 25 176 168 987 84 165 31 7 14 80 194 101 127 42 2 48 39 13 132 24 81 134 123 119 107 147 126 6 169

View File

@ -0,0 +1,18 @@
## z:\Chao\src\2865_deletenum\test\in.txt
2020/05/02 ÖÜÁù 18:34:11.05
2835
-----------------------------------------------
Process exited after 150 ms with return value 0
## z:\Chao\src\2865_deletenum\test\in2.txt
2020/05/02 ÖÜÁù 18:34:11.05
7042
-----------------------------------------------
Process exited after 90 ms with return value 0
## z:\Chao\src\2865_deletenum\test\in3.txt
2020/05/02 ÖÜÁù 18:34:11.05
38302
-----------------------------------------------
Process exited after 90 ms with return value 0