Merge branch 'main' of http://10.10.14.176:3000/huanghai/python
commit
8022acfd97
@ -1,48 +1,9 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
const int INF = 0x3f3f3f3f;
|
||||
const int N = 110;
|
||||
double a[N];
|
||||
int n;
|
||||
int f1[N], f2[N];
|
||||
#define endl '\n'
|
||||
int main() {
|
||||
cin >> n;
|
||||
for (int i = 1; i <= n; i++) cin >> a[i];
|
||||
for (int i = 1; i <= n; i++) {
|
||||
f1[i] = 1;
|
||||
for (int j = 1; j < i; j++)
|
||||
if (a[i] > a[j]) f1[i] = max(f1[i], f1[j] + 1);
|
||||
}
|
||||
for (int i = n; i >= 1; i--) {
|
||||
f2[i] = 1;
|
||||
for (int j = 1; j < i; j++)
|
||||
if (a[i] > a[j]) f2[i] = max(f1[i], f1[j] + 1);
|
||||
}
|
||||
bool flag = true;
|
||||
for (int i = 1; i <= n; i++)
|
||||
if (f1[i] != 1) {
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
if (flag) {
|
||||
cout << -1 << endl;
|
||||
exit(0);
|
||||
}
|
||||
flag = true;
|
||||
for (int i = 1; i <= n; i++)
|
||||
if (f2[i] != 1) {
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
if (flag) {
|
||||
cout << -1 << endl;
|
||||
exit(0);
|
||||
}
|
||||
int mx = -1;
|
||||
for (int i = 1; i <= n; i++){
|
||||
int t = f1[i] + f2[i];
|
||||
mx = max(mx, t);
|
||||
}
|
||||
cout << n - mx + 1;
|
||||
// 加快读入
|
||||
ios::sync_with_stdio(false), cin.tie(0);
|
||||
cout << "dd" << endl;
|
||||
return 0;
|
||||
}
|
@ -1,16 +1,9 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
int n;
|
||||
const int N = 110;
|
||||
typedef long long LL;
|
||||
LL a[N];
|
||||
LL res;
|
||||
|
||||
#define endl '\n'
|
||||
int main() {
|
||||
while (cin >> a[++n]);
|
||||
n--;
|
||||
for (int i = 1; i <= n; i++)res += a[i] * pow(2, n - 1);
|
||||
printf("%d", res);
|
||||
// 加快读入
|
||||
ios::sync_with_stdio(false), cin.tie(0);
|
||||
cout << "aaa" << endl;
|
||||
return 0;
|
||||
}
|
@ -1,25 +1,25 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Win32",
|
||||
"compilerArgs": [
|
||||
"-fexec-charset=GBK"
|
||||
],
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/10.3.0/**",
|
||||
"C:/TDM-GCC-64/x86_64-w64-mingw32/include/**"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE",
|
||||
"_UNICODE"
|
||||
],
|
||||
"compilerPath": "C:/TDM-GCC-64/bin/gcc.exe",
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17",
|
||||
"intelliSenseMode": "gcc-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Win32",
|
||||
"compilerArgs": [
|
||||
"-fexec-charset=GBK"
|
||||
],
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/10.3.0/**",
|
||||
"C:/TDM-GCC-64/x86_64-w64-mingw32/include/**"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE",
|
||||
"_UNICODE"
|
||||
],
|
||||
"compilerPath": "C:/TDM-GCC-64/bin/gcc.exe",
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17",
|
||||
"intelliSenseMode": "gcc-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
Loading…
Reference in new issue