Sun, 10 Mar 2019 21:27:08 GMT
parent
f1e80153e1
commit
c7ccfea1ae
@ -1,8 +1,22 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
|
||||
int main() {
|
||||
int x;
|
||||
scanf("%d", &x);
|
||||
vector<int> v;
|
||||
while (~scanf("%d", &x))
|
||||
v.push_back(x);
|
||||
sort(v.begin(), v.end());
|
||||
for (int i = 1; i < v.size(); i++)
|
||||
if (v[i - 1] == v[i] - 2)
|
||||
printf("%d ", v[i] - 1);
|
||||
for (int i = 1; i < v.size(); i++)
|
||||
if (v[i - 1] == v[i])
|
||||
printf("%d", v[i]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,8 +1,20 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
char str1[1 << 10], str2[1 << 10];
|
||||
|
||||
int main() {
|
||||
scanf("%s%s", str1, str2);
|
||||
int ans = 0, prev = -1, len = strlen(str1);
|
||||
for (int i = 0; i < len; i++)
|
||||
if (str1[i] != str2[i])
|
||||
if (~prev)
|
||||
ans += i - prev, prev = -1;
|
||||
else
|
||||
prev = i;
|
||||
printf("%d", ans);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,8 +1,25 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a[50050];
|
||||
|
||||
int main() {
|
||||
int n, ans = 0;
|
||||
scanf("%d", &n);
|
||||
for (int i = 0; i < n; i++)
|
||||
scanf("%d", a + i);
|
||||
for (int i = 0; i < n; i++) {
|
||||
int mx = a[i], mn = a[i];
|
||||
for (int j = i; j < n; j++) {
|
||||
mx = max(mx, a[j]);
|
||||
mn = min(mn, a[j]);
|
||||
if (mx - mn == j - i)
|
||||
ans++;
|
||||
}
|
||||
}
|
||||
printf("%d", ans);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,8 +1,33 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
|
||||
int main() {
|
||||
int m, n;
|
||||
scanf("%d%d", &m, &n);
|
||||
list<int> lst;
|
||||
for (int i = 1; i <= n; i += 2)
|
||||
lst.push_back(i);
|
||||
int modcnt = 0, st = 3, rcnt = 2;
|
||||
do {
|
||||
modcnt = 0;
|
||||
int poscnt = 1;
|
||||
for (list<int>::iterator ite = lst.begin(); ite != lst.end(); poscnt++)
|
||||
if (poscnt == rcnt) {
|
||||
st = *ite++;
|
||||
} else if (poscnt % st == 0) {
|
||||
lst.erase(ite++);
|
||||
modcnt++;
|
||||
} else ++ite;
|
||||
rcnt++;
|
||||
} while (modcnt);
|
||||
int ans = 0;
|
||||
for (list<int>::iterator ite = lst.begin(); ite != lst.end(); ++ite)
|
||||
if (m < *ite && *ite < n)
|
||||
ans++;
|
||||
printf("%d", ans);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,8 +1,18 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
using ll=long long;
|
||||
struct mat {
|
||||
ll x[2][2];
|
||||
};
|
||||
|
||||
mat operator*(const mat &lhs, const mat &rhs) {
|
||||
|
||||
}
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
Reference in new issue