0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-08 14:18:47 +00:00

fix: format all cpp codes

This commit is contained in:
Baoshuo Ren 2021-11-19 17:01:13 +08:00 committed by Baoshuo Ren
parent 9f0d4bedd0
commit f0aae01668
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68
170 changed files with 586 additions and 728 deletions

View File

@ -5,6 +5,6 @@ using namespace std;
int main() {
double x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
cout << fixed << setprecision(4) << sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)) << endl;
cout << fixed << setprecision(4) << sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)) << endl;
return 0;
}

View File

@ -27,8 +27,8 @@ void dfs(int u) {
int main() {
cin >> n;
for(int i = 0 ; i < n ; i++) {
for(int j = 0 ; j < n ; j++) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
g[i][j] = '.';
}
}

View File

@ -8,7 +8,8 @@ string s;
int main() {
cin >> s;
sort(s.begin(), s.end());
do ans++;
do
ans++;
while (next_permutation(s.begin(), s.end()));
cout << ans << endl;
return 0;

View File

@ -45,8 +45,10 @@ void modify(int u, int x, int v) {
return;
}
int mid = tr[u].l + tr[u].r >> 1;
if (x <= mid) modify(u << 1, x, v);
else modify(u << 1 | 1, x, v);
if (x <= mid)
modify(u << 1, x, v);
else
modify(u << 1 | 1, x, v);
pushup(u);
}
@ -64,4 +66,4 @@ int main() {
}
}
return 0;
}
}

View File

@ -1,3 +1,5 @@
#include<stdio.h>
char s[]="#include<stdio.h>%cchar%cs[]=%c%s%c%c%cint main(){printf(s,10,32,34,s,34,59,10);}";
int main(){printf(s,10,32,34,s,34,59,10);}
#include <stdio.h>
char s[] = "#include<stdio.h>%cchar%cs[]=%c%s%c%c%cint main(){printf(s,10,32,34,s,34,59,10);}";
int main() {
printf(s, 10, 32, 34, s, 34, 59, 10);
}

View File

@ -1,6 +1,7 @@
#include "interaction.h"
#include <bits/stdc++.h>
#include "interaction.h"
using namespace std;
int n;

View File

@ -4,7 +4,7 @@ using namespace std;
int main() {
char c;
int n = 0, a = 0;
int n = 0, a = 0;
while (cin >> c) {
n++;
if (c == 'a') {

View File

@ -1,4 +1,4 @@
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
@ -10,8 +10,8 @@ int main() {
s += t;
cin >> t;
s += t;
for(int i = 0 ; i < 9 ; i++) {
if(s[i] != s[8-i]) {
for (int i = 0; i < 9; i++) {
if (s[i] != s[8 - i]) {
cout << "NO" << endl;
return 0;
}

View File

@ -1,11 +1,11 @@
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, a, b;
cin >> t;
while(t--) {
while (t--) {
cin >> a >> b;
cout << a + b - (a & b) * 2 << endl;
}

View File

@ -6,7 +6,7 @@ int main() {
int t;
cin >> t;
while (t--) {
int n, x, a[55], b[55];
int n, x, a[55], b[55];
bool flag = false;
cin >> n >> x;
for (int i = 0; i < n; i++) {
@ -25,11 +25,9 @@ int main() {
}
if (flag) {
cout << "No" << endl;
}
else {
} else {
cout << "Yes" << endl;
}
}
return 0;
}

View File

@ -3,9 +3,9 @@
using namespace std;
int main() {
int n, m;
int minx = 0x3f3f3f, miny = 0x3f3f3f;
int maxx = 0x000000, maxy = 0x000000;
int n, m;
int minx = 0x3f3f3f, miny = 0x3f3f3f;
int maxx = 0x000000, maxy = 0x000000;
string s[55];
cin >> n >> m;
for (int i = 0; i < n; i++) {

View File

@ -9,12 +9,11 @@ int main() {
for (int i = 0; i < n; i++) {
if (i >= 3) {
cin >> t;
}
else {
} else {
t = a[i];
}
if (t % 2 != o) {
cout << i+1 << endl;
cout << i + 1 << endl;
return 0;
}
}

View File

@ -3,7 +3,7 @@
using namespace std;
int main() {
int n;
int n;
string s;
cin >> n >> s;
for (int i = 0; i < n; i++) {

View File

@ -3,9 +3,9 @@
using namespace std;
int main() {
int n, t, max_score = -0x3f3f3f3f;
int scores[1005];
string s, max_player, players[1005];
int n, t, max_score = -0x3f3f3f3f;
int scores[1005];
string s, max_player, players[1005];
map<string, int> m, m1;
cin >> n;
for (int i = 0; i < n; i++) {

View File

@ -10,11 +10,9 @@ int main() {
// abc abd acd bcd
if (a + b > c && a + c > b && b + c > a || a + b > d && a + d > b && b + d > a || a + c > d && a + d > c && c + d > a || b + c > d && b + d > c && c + d > b) {
cout << "TRIANGLE" << endl;
}
else if (a + b >= c && a + c >= b && b + c >= a || a + b >= d && a + d >= b && b + d >= a || a + c >= d && a + d >= c && c + d >= a || b + c >= d && b + d >= c && c + d >= b) {
} else if (a + b >= c && a + c >= b && b + c >= a || a + b >= d && a + d >= b && b + d >= a || a + c >= d && a + d >= c && c + d >= a || b + c >= d && b + d >= c && c + d >= b) {
cout << "SEGMENT" << endl;
}
else {
} else {
cout << "IMPOSSIBLE" << endl;
}
return 0;

View File

@ -1,4 +1,4 @@
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
@ -10,20 +10,18 @@ int main() {
int n;
pair<int, int> p[200005];
cin >> n;
for(int i = 0 ; i < n ; i++) {
for (int i = 0; i < n; i++) {
cin >> p[i].first >> p[i].second;
}
sort(p, p+n, cmp);
sort(p, p + n, cmp);
int tv1 = -1, tv2 = -1;
for(int i = 0 ; i < n ; i++) {
if(p[i].first > tv1) {
for (int i = 0; i < n; i++) {
if (p[i].first > tv1) {
tv1 = p[i].second;
}
else {
if(p[i].first > tv2) {
} else {
if (p[i].first > tv2) {
tv2 = p[i].second;
}
else {
} else {
cout << "NO" << endl;
return 0;
}

View File

@ -5,7 +5,7 @@
using namespace std;
int main() {
int a, b, c;
int a, b, c;
string ans;
cin >> a >> b;
c = max(a, b);

View File

@ -4,9 +4,9 @@ using namespace std;
const int fx[] = {0, -2, -1, 1, 2, 2, 1, -1, -2};
const int fy[] = {0, 1, 2, 2, 1, -1, -2, -2, -1};
int bx, by, mx, my;
int bx, by, mx, my;
long long f[30][30];
bool b[30][30];
bool b[30][30];
int main() {
cin >> bx >> by >> mx >> my;
@ -14,7 +14,7 @@ int main() {
by += 2;
mx += 2;
my += 2;
f[2][2] = 1;
f[2][2] = 1;
b[mx][my] = true;
for (int i = 1; i <= 8; i++) {
b[mx + fx[i]][my + fy[i]] = true;
@ -23,8 +23,7 @@ int main() {
for (int j = 2; j <= by; j++) {
if (b[i][j]) {
continue;
}
else {
} else {
f[i][j] = max(f[i][j], f[i - 1][j] + f[i][j - 1]);
}
}

View File

@ -9,30 +9,28 @@ bool check(string s) {
}
string add(string b, int k) {
string a = b;
char sixt[20] = "0123456789ABCDEF";
string a = b;
char sixt[20] = "0123456789ABCDEF";
reverse(a.begin(), a.end());
int numa[105], numb[105], numc[105];
int len = a.length(), lenc = 1;
int numa[105], numb[105], numc[105];
int len = a.length(), lenc = 1;
string ans;
for (int i = 0; i < len; i++) {
if (isdigit(a[i])) {
numa[len - i] = a[i] - '0';
}
else {
} else {
numa[len - i] = a[i] - 'A' + 10;
}
if (isdigit(b[i])) {
numb[len - i] = b[i] - '0';
}
else {
} else {
numb[len - i] = b[i] - 'A' + 10;
}
}
int x = 0;
while (lenc <= len) {
numc[lenc] = numa[lenc] + numb[lenc] + x;
x = numc[lenc] / k;
x = numc[lenc] / k;
numc[lenc] %= k;
lenc++;
}
@ -47,7 +45,7 @@ string add(string b, int k) {
}
int main() {
int n;
int n;
string m;
cin >> n >> m;
for (int i = 0; i <= 30; i++) {

View File

@ -5,25 +5,25 @@ using namespace std;
int n, l1, l2, a[100005], d1[100005], d2[100005];
int main() {
while (cin >> a[++n]);
while (cin >> a[++n])
;
n--;
d1[++l1] = d2[++l2] = a[1];
for (int i = 2; i <= n; i++) {
if (d1[l1] >= a[i]) {
d1[++l1] = a[i];
}
else {
} else {
int* it = upper_bound(d1 + 1, d1 + 1 + l1, a[i], greater<int>());
*it = a[i];
}
if (d2[l2] < a[i]) {
d2[++l2] = a[i];
}
else {
} else {
int* it = lower_bound(d2 + 1, d2 + 1 + l2, a[i], less<int>());
*it = a[i];
}
}
cout << l1 << endl << l2 << endl;
cout << l1 << endl
<< l2 << endl;
return 0;
}

View File

@ -5,7 +5,7 @@
using namespace std;
double a, b, c, d;
int cnt;
int cnt;
double fc(double x) {
return a * x * x * x + b * x * x + c * x + d;

View File

@ -14,8 +14,7 @@ int main() {
for (int j = 0; j <= n; j++) {
if (j >= v[i]) {
f[i][j] = max(f[i - 1][j], f[i - 1][j - v[i]] + w[i]);
}
else {
} else {
f[i][j] = f[i - 1][j];
}
}

View File

@ -21,8 +21,7 @@ int main() {
if (n == 5 && m == 3) {
printf("78 4\n2783 95\n9323 89\n7972 88\n2538 78");
return 0;
}
else if (n == 87 && m == 35) {
} else if (n == 87 && m == 35) {
printf("77 52\n5081 100\n8736 100\n2855 99\n6347 99\n3191 96\n6090 95\n9917 95\n1832 94\n3169 92\n3404 92\n6982 92\n9494 92\n3535 91\n8569 91\n9319 90\n1896 89\n9701 89\n3321 88\n6017 88\n6158 88\n6361 88\n7353 88\n4011 87\n4967 87\n8017 87\n8944 87\n4746 86\n7313 86\n7486 86\n9250 86\n4808 85\n4982 85\n6979 85\n7327 85\n7887 85\n7651 84\n8456 84\n8850 84\n1423 83\n7889 82\n6891 81\n8779 81\n1174 80\n4116 80\n4141 80\n5473 80\n7172 79\n8562 79\n5392 78\n4301 77\n4551 77\n5498 77\n");
return 0;
}

View File

@ -4,14 +4,13 @@ using namespace std;
int main() {
string k, c;
int t = 0;
int t = 0;
cin >> k >> c;
for (int i = 0; i < c.size(); i++) {
t = (k[i % k.size()] & 31) - 1;
if((c[i] & 31) - t > 0) {
if ((c[i] & 31) - t > 0) {
c[i] = c[i] - t;
}
else {
} else {
c[i] = c[i] - t + 26;
}
}

View File

@ -1,10 +1,10 @@
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
struct node {
int chinese, math, english, all, id;
node() {
id = chinese = math = english = all = 0;
}
@ -18,8 +18,8 @@ struct node {
};
bool cmp(node a, node b) {
if(a.all == b.all) {
if(a.chinese == b.chinese) {
if (a.all == b.all) {
if (a.chinese == b.chinese) {
return a.id < b.id;
}
return a.chinese > b.chinese;
@ -31,13 +31,13 @@ int main() {
int n;
node a[305];
cin >> n;
for(int i = 0 ; i < n ; i++) {
for (int i = 0; i < n; i++) {
cin >> a[i].chinese >> a[i].math >> a[i].english;
a[i].all = a[i].chinese + a[i].math + a[i].english;
a[i].id = i+1;
a[i].id = i + 1;
}
sort(a, a+n, cmp);
for(int i = 0 ; i < 5 ; i++) {
sort(a, a + n, cmp);
for (int i = 0; i < 5; i++) {
cout << a[i].id << ' ' << a[i].all << endl;
}
return 0;

View File

@ -15,8 +15,7 @@ int main() {
l++;
r--;
ans++;
}
else {
} else {
r--;
ans++;
}

View File

@ -3,9 +3,9 @@
using namespace std;
int main() {
set<int> s;
set<int> s;
map<int, int> m;
int n, t;
int n, t;
cin >> n;
while (n--) {
cin >> t;

View File

@ -2,11 +2,11 @@
using namespace std;
int n;
int u[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int v[8] = {1, 1, 0, -1, -1, -1, 0, 1};
bool vis[101][101];
string s[105];
int n;
int u[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int v[8] = {1, 1, 0, -1, -1, -1, 0, 1};
bool vis[101][101];
string s[105];
map<char, char> wd;
bool dfs(int x, int y, char w, int p) {

View File

@ -3,8 +3,8 @@
using namespace std;
int main() {
long long n, c, ans = 0;
int a[200005];
long long n, c, ans = 0;
int a[200005];
map<int, int> b;
cin >> n >> c;
for (int i = 1; i <= n; i++) {

View File

@ -6,7 +6,7 @@ using namespace std;
struct node {
string name;
int y, m, d, i;
int y, m, d, i;
node() {
name = "";
@ -28,7 +28,7 @@ bool cmp(node a, node b) {
}
int main() {
int n;
int n;
node a[1005];
cin >> n;
for (int i = 0; i < n; i++) {

View File

@ -14,15 +14,13 @@ int main() {
for (int i = 0; i < n; i++) {
if (a[i] > r) {
p += a[i] - r;
}
else if (a[i] < l) {
} else if (a[i] < l) {
q += l - a[i];
}
}
if (n * r < sum) {
cout << -1 << endl;
}
else {
} else {
cout << max(p, q) << endl;
}
return 0;

View File

@ -1,23 +1,23 @@
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, m, a[2005][2005], f[2005][2005];
cin >> n >> m;
for(int i = 1 ; i <= m ; i++) {
for(int j = 1 ; j <= n ; j++) {
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++) {
cin >> a[j][i];
}
}
for(int i = 1 ; i <= n ; i++) {
f[i-1][0] = f[i-1][m];
for(int j = 1 ; j <= m ; j++) {
f[i][j] = a[i][j] + min(f[i-1][j], f[i-1][j-1]);
for (int i = 1; i <= n; i++) {
f[i - 1][0] = f[i - 1][m];
for (int j = 1; j <= m; j++) {
f[i][j] = a[i][j] + min(f[i - 1][j], f[i - 1][j - 1]);
}
}
long long ans = f[n][1];
for(int i = 2 ; i <= m ; i++) {
for (int i = 2; i <= m; i++) {
ans = min(ans, f[n][i]);
}
cout << ans << endl;

View File

@ -14,8 +14,7 @@ int main() {
n = unique(a, a + n) - a;
if (k >= n) {
cout << "NO RESULT" << endl;
}
else {
} else {
cout << a[--k];
}
return 0;

View File

@ -62,7 +62,7 @@ char itoc(int x) {
int main() {
long long i, n = 0, p1, p2, x = 1;
string s, res = "";
string s, res = "";
cin >> p1 >> s >> p2;
for (i = s.size() - 1; i >= 0; i--) {
n += ctoi(s[i]) * x;

View File

@ -1,6 +1,6 @@
// R38820772
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
@ -9,12 +9,12 @@ int n, a[1005];
int main() {
cin >> n;
for(int i = 0 ; i < n ; i++) {
cin >>a[i];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for(int i = 1 ; i < n ; i++) {
if(!cnt[abs(a[i]-a[i-1])]) {
cnt[abs(a[i]-a[i-1])] = true;
for (int i = 1; i < n; i++) {
if (!cnt[abs(a[i] - a[i - 1])]) {
cnt[abs(a[i] - a[i - 1])] = true;
} else {
cout << "Not jolly" << endl;
return 0;

View File

@ -4,8 +4,8 @@
using namespace std;
int n, m;
int num[105];
int n, m;
int num[105];
bool vis[105];
void dfs(int k) {

View File

@ -1,6 +1,6 @@
// R36448353
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
@ -10,10 +10,10 @@ int main() {
double a;
n = t = ans = 0;
cin >> n;
for(int i = 1 ; i <= n ; i++) {
for (int i = 1; i <= n; i++) {
cin >> a >> t;
for(int j = 1 ; j <= t ; j++) {
ans ^= int(j*a);
for (int j = 1; j <= t; j++) {
ans ^= int(j * a);
}
}
cout << ans << endl;

View File

@ -23,8 +23,7 @@ int main() {
cin >> a[i][j];
if (a[i][j] == 0) {
b[i][j] = 0;
}
else {
} else {
b[i][j] = 1;
}
}
@ -34,11 +33,9 @@ int main() {
for (int j = 1; j <= n; j++) {
if (b[i][j] == 2) {
cout << "0 ";
}
else if (b[i][j] == 0) {
} else if (b[i][j] == 0) {
cout << "2 ";
}
else {
} else {
cout << "1 ";
}
}

View File

@ -11,8 +11,7 @@ int main() {
mid = (l + r) / 2;
if (pow(1.0 / (1.0 + mid), k) >= 1 - n / m * mid) {
r = mid;
}
else {
} else {
l = mid;
}
}

View File

@ -1,4 +1,4 @@
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
@ -7,24 +7,23 @@ int main() {
priority_queue<int, vector<int>, less<int> > s;
priority_queue<int, vector<int>, greater<int> > l;
cin >> n;
for(int i = 1 ; i <= n ; i++) {
for (int i = 1; i <= n; i++) {
cin >> a[i];
k = i/2+1;
if(!l.empty() && a[i] >= l.top()) {
k = i / 2 + 1;
if (!l.empty() && a[i] >= l.top()) {
s.push(a[i]);
}
else {
} else {
l.push(a[i]);
}
while(l.size() < k) {
while (l.size() < k) {
l.push(s.top());
s.pop();
}
while(s.size() < k) {
while (s.size() < k) {
s.push(l.top());
l.pop();
}
if(i%2) {
if (i % 2) {
cout << s.top() << endl;
}
}

View File

@ -1,21 +1,21 @@
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if(b == 0) {
if (b == 0) {
return a;
}
return gcd(b, a%b);
return gcd(b, a % b);
}
int main() {
int t;
cin >> t;
while(t--) {
while (t--) {
int ax, ay, bx, by;
cin >> ax >> ay >> bx >> by;
cout << (gcd(abs(ax-bx), abs(ay-by)) == 1 ? "no" : "yes") << endl;
cout << (gcd(abs(ax - bx), abs(ay - by)) == 1 ? "no" : "yes") << endl;
}
return 0;
}

View File

@ -10,8 +10,7 @@ int main() {
if (sum + t > m) {
ans++;
sum = t;
}
else {
} else {
sum += t;
}
}

View File

@ -9,8 +9,7 @@ bool check(int x) {
for (int i = 1; i <= n; i++) {
if (tot + a[i] <= x) {
tot += a[i];
}
else {
} else {
tot = a[i];
num++;
}
@ -28,8 +27,7 @@ int main() {
mid = l + r >> 1;
if (check(mid)) {
l = mid + 1;
}
else {
} else {
r = mid - 1;
}
}

View File

@ -26,12 +26,10 @@ int main() {
if (op == 'A') {
a[++n] = (x + t) % d;
change(n);
}
else if (op == 'Q') {
} else if (op == 'Q') {
if (x == 1) {
cout << (t = a[n]) << endl;
}
else {
} else {
cout << (t = find(n - x + 1, n)) << endl;
}
}

View File

@ -8,16 +8,22 @@ int main() {
getline(cin, a);
getline(cin, b);
for (int i = 0; i < 7; i++) {
if (a[i] <= 0) break;
else us *= a[i] - 64;
if (a[i] <= 0)
break;
else
us *= a[i] - 64;
}
for (int i = 0; i < 7; i++) {
if (b[i] <= 0) break;
else zs *= b[i] - '@';
if (b[i] <= 0)
break;
else
zs *= b[i] - '@';
}
us %= 47;
zs %= 47;
if (us == zs) cout << "GO" << endl;
else cout << "STAY" << endl;
if (us == zs)
cout << "GO" << endl;
else
cout << "STAY" << endl;
return 0;
}

View File

@ -26,8 +26,7 @@ int main() {
for (int i = 1; i < n; i++) {
if (a[i].start <= end) {
end = max(end, a[i].end);
}
else {
} else {
ans1 = max(ans1, end - start);
ans2 = max(ans2, a[i].start - end);
start = a[i].start;

View File

@ -1,6 +1,6 @@
// R36572888
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;

View File

@ -1,23 +1,23 @@
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a[1005][1005], f[1005][1005];
cin >> n;
for(int i = 1 ; i <= n ; i++) {
for(int j = 1 ; j <= i ; j++) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i; j++) {
cin >> a[i][j];
}
}
f[1][1] = a[1][1];
for(int i = 1 ; i <= n ; i++) {
for(int j = 1 ; j <= i+1 ; j++) {
f[i][j] = a[i][j] + max(f[i-1][j], f[i-1][j-1]);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i + 1; j++) {
f[i][j] = a[i][j] + max(f[i - 1][j], f[i - 1][j - 1]);
}
}
int ans = -0x3f3f3f;
for(int i = 1 ; i <= n ; i++) {
for (int i = 1; i <= n; i++) {
ans = max(ans, f[n][i]);
}
cout << ans << endl;

View File

@ -22,12 +22,10 @@ int main() {
if (st.empty() || b[st.top()] != s[i]) {
if (s[i] == ')') {
b[i] = '(';
}
else {
} else {
b[i] = '[';
}
}
else {
} else {
b[st.top()] = ' ';
st.pop();
}

View File

@ -6,10 +6,10 @@ struct point {
long long x, y;
};
int n, m;
bool v[5005];
int n, m;
bool v[5005];
long long d[5005];
point city[5005];
point city[5005];
void prim() {
memset(d, 0x3f, sizeof(d));

View File

@ -1,17 +1,17 @@
// R38787626
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, a[2000005];
cin >> n >> m;
for(int i = 0 ; i < m ; i++) {
for (int i = 0; i < m; i++) {
cin >> a[i];
}
sort(a, a+m);
for(int i = 0 ; i < m ; i++) {
sort(a, a + m);
for (int i = 0; i < m; i++) {
cout << a[i] << ' ';
}
cout << endl;

File diff suppressed because one or more lines are too long

View File

@ -5,33 +5,33 @@
using namespace std;
int main() {
int n, c; // n: 题意中的N, c: count
char l; // 上一个出现的字符
string s[205]; // 数组
int n, c; // n: 题意中的N, c: count
char l; // 上一个出现的字符
string s[205]; // 数组
n = c = 0;
l = '0';
cin >> s[0];
n = s[0].size();
for(int i = 1 ; i < n ; i++) {
for (int i = 1; i < n; i++) {
cin >> s[i];
}
cout << n << " ";
for(int i = 0 ; i < n ; i++) {
for(int j = 0 ; j < n ; j++) {
if(s[i][j] == l) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (s[i][j] == l) {
c++;
} else {
cout << c << " "; // 输出以前统计完的
c = 1; // 坑点: 这里一定要赋值为1, 因为当前字符也算
l = s[i][j]; // 设置当前字符为继续统计对象
cout << c << " "; // 输出以前统计完的
c = 1; // 坑点: 这里一定要赋值为1, 因为当前字符也算
l = s[i][j]; // 设置当前字符为继续统计对象
}
}
}
cout << c << endl; // 坑点: 要输出最后一个统计
cout << c << endl; // 坑点: 要输出最后一个统计
return 0;
}

View File

@ -6,7 +6,7 @@ using namespace std;
int main() {
string s;
int boy, girl;
int boy, girl;
boy = girl = 0;
cin >> s;
@ -17,6 +17,7 @@ int main() {
girl += (s[i] == 'g' || s[i + 1] == 'i' || s[i + 2] == 'r' || s[i + 3] == 'l');
}
cout << boy << endl << girl << endl;
cout << boy << endl
<< girl << endl;
return 0;
}

View File

@ -4,8 +4,8 @@ using namespace std;
/* Template: 树形 DP */
vector<int> son[6005];
int n, l, k, f[6005][2], h[6005];
bool v[6005];
int n, l, k, f[6005][2], h[6005];
bool v[6005];
void dp(int x) {
int y;

View File

@ -12,7 +12,7 @@ int main() {
f[i] = 0x3f3f3f;
}
f[n] = 0;
for (int i = n-1; i >= 0; i--) {
for (int i = n - 1; i >= 0; i--) {
for (int j = i + 1; j <= n; j++) {
f[i] = min(f[i], f[j] + a[i][j]);
}

View File

@ -6,17 +6,17 @@ int n, m, op, l, r, k, d, p, a[100005];
int main() {
cin >> n >> m;
for(int i = 1 ; i <= n ; i++) {
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for(int i = 0 ; i < m ; i++) {
for (int i = 0; i < m; i++) {
cin >> op;
if(op == 1) {
if (op == 1) {
cin >> l >> r >> k >> d;
for(int j = l ; j <= r ; j++) {
for (int j = l; j <= r; j++) {
a[j] += k + (j - l) * d;
}
} else if(op == 2) {
} else if (op == 2) {
cin >> p;
cout << a[p] << endl;
}

View File

@ -4,30 +4,27 @@ using namespace std;
int main() {
stack<int> st;
char ch;
int a, b, t = 0;
char ch;
int a, b, t = 0;
while (cin >> ch, ch != '@') {
if (ch == '.') {
st.push(t);
t = 0;
}
else if('0' <= ch && ch <= '9') {
} else if ('0' <= ch && ch <= '9') {
t *= 10;
t += ch - '0';
}
else {
b = st.top(); st.pop();
a = st.top(); st.pop();
} else {
b = st.top();
st.pop();
a = st.top();
st.pop();
if (ch == '+') {
st.push(a + b);
}
else if (ch == '-') {
} else if (ch == '-') {
st.push(a - b);
}
else if (ch == '*') {
} else if (ch == '*') {
st.push(a * b);
}
else if (ch == '/') {
} else if (ch == '/') {
st.push(a / b);
}
}

View File

@ -43,8 +43,7 @@ void modify(int u, int x, int d) {
int mid = tr[u].l + tr[u].r >> 1;
if (x <= mid) {
modify(u << 1, x, d);
}
else {
} else {
modify(u << 1 | 1, x, d);
}
pushup(u);
@ -75,8 +74,7 @@ int main() {
cin >> op >> x >> y;
if (op == 'U') {
modify(1, x, y);
}
else if (op == 'Q') {
} else if (op == 'Q') {
cout << query(1, x, y) << endl;
}
}

View File

@ -5,10 +5,10 @@
using namespace std;
int main() {
int m, n, t, f = 0, ans = 0;
bool flag = false;
int m, n, t, f = 0, ans = 0;
bool flag = false;
vector<int> memory;
queue<int> mq;
queue<int> mq;
cin >> m >> n;
for (int i = 0; i < n; i++) {
cin >> t;

View File

@ -22,8 +22,7 @@ int main() {
cin >> x >> y;
if (find(x) == find(y)) {
cout << "Yes" << endl;
}
else {
} else {
cout << "No" << endl;
}
}

View File

@ -7,13 +7,13 @@ using namespace std;
int n, m, js[10];
int main() {
cin >> n >> m;
for(int i = n ; i <= m ; i++) {
for(int j = i ; j ; j /= 10) {
js[j%10]++;
cin >> n >> m;
for (int i = n; i <= m; i++) {
for (int j = i; j; j /= 10) {
js[j % 10]++;
}
}
for(int i = 0 ; i < 10 ; i++) {
}
for (int i = 0; i < 10; i++) {
cout << js[i] << " ";
}
return 0;

View File

@ -6,12 +6,12 @@ using namespace std;
struct node {
string name;
bool towards;
bool towards;
};
int main() {
// freopen("data/P1563_sample1.in", "r", stdin);
int n, m, now = 0, x, y;
int n, m, now = 0, x, y;
node a[100005];
cin >> n >> m;
for (int i = 0; i < n; i++) {
@ -22,16 +22,13 @@ int main() {
if (a[now].towards == 0) {
if (x == 0) {
now = (now + n - y) % n;
}
else if (x == 1) {
} else if (x == 1) {
now = (now + y) % n;
}
}
else if (a[now].towards == 1) {
} else if (a[now].towards == 1) {
if (x == 0) {
now = (now + y) % n;
}
else if (x == 1) {
} else if (x == 1) {
now = (now + n - y) % n;
}
}

View File

@ -12,8 +12,7 @@ int main() {
for (int i = 1; i < n; i++) {
if (a[i] > a[i - 1]) {
f[i] = f[i - 1] + 1;
}
else {
} else {
f[i] = 0;
}
}

View File

@ -1,6 +1,6 @@
// https://www.luogu.com.cn/record/38654562
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
@ -11,14 +11,14 @@ int main() {
a = b = c = 0;
cin >> s;
for(int i = 0 ; i < s.size() ; i += 5) {
cout << s[i] << ' ' << s[i+3] << ' ';
switch(s[i]) {
for (int i = 0; i < s.size(); i += 5) {
cout << s[i] << ' ' << s[i + 3] << ' ';
switch (s[i]) {
case 'a':
if('0' <= s[i+3] && s[i+3] <= '9') {
a = s[i+3] - '0';
if ('0' <= s[i + 3] && s[i + 3] <= '9') {
a = s[i + 3] - '0';
} else {
switch(s[i+3]) {
switch (s[i + 3]) {
case 'a':
a = a;
break;
@ -32,10 +32,10 @@ int main() {
}
break;
case 'b':
if('0' <= s[i+3] && s[i+3] <= '9') {
b = s[i+3] - '0';
if ('0' <= s[i + 3] && s[i + 3] <= '9') {
b = s[i + 3] - '0';
} else {
switch(s[i+3]) {
switch (s[i + 3]) {
case 'a':
b = a;
break;
@ -49,10 +49,10 @@ int main() {
}
break;
case 'c':
if('0' <= s[i+3] && s[i+3] <= '9') {
c = s[i+3] - '0';
if ('0' <= s[i + 3] && s[i + 3] <= '9') {
c = s[i + 3] - '0';
} else {
switch(s[i+3]) {
switch (s[i + 3]) {
case 'a':
c = a;
break;

View File

@ -6,7 +6,7 @@ using namespace std;
int main() {
char c;
int cnt[30];
int cnt[30];
memset(cnt, 0x00, sizeof(cnt));
while (cin >> c) {
cnt[c - 'A']++;
@ -30,8 +30,7 @@ int main() {
if (cnt[j] == max) {
printf("%s%c", j == 0 ? "" : " ", '*');
cnt[j]--;
}
else {
} else {
printf("%s%s", j == 0 ? "" : " ", " ");
}
}

View File

@ -1,98 +1,98 @@
// https://www.luogu.com.cn/record/20137358
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
long long c = 0, word[6] = {0,0,0,0,0,0}, out = 0;
long long c = 0, word[6] = {0, 0, 0, 0, 0, 0}, out = 0;
int getst(string s, long long &c) {
if(s=="one" || s=="a" || s=="first" || s=="another") {
word[c] = 1 ;
if (s == "one" || s == "a" || s == "first" || s == "another") {
word[c] = 1;
c++;
return 0;
}
if(s == "two" || s == "both" || s == "second") {
if (s == "two" || s == "both" || s == "second") {
word[c] = 4;
c++;
return 0;
}
if(s == "three" || s == "third") {
word[c]=9;
if (s == "three" || s == "third") {
word[c] = 9;
c++;
return 0;
}
if(s == "four") {
if (s == "four") {
word[c] = 16;
c++;
return 0;
}
if(s == "five") {
if (s == "five") {
word[c] = 25;
c++;
return 0;
}
if(s == "six") {
if (s == "six") {
word[c] = 36;
c++;
return 0;
}
if(s == "seven") {
if (s == "seven") {
word[c] = 49;
c++;
return 0;
}
if(s == "eight") {
if (s == "eight") {
word[c] = 64;
c++;
return 0;
}
if(s == "nine") {
if (s == "nine") {
word[c] = 81;
c++;
return 0;
}
if(s == "eleven") {
}
if (s == "eleven") {
word[c] = 21;
c++;
return 0;
}
if(s == "twelve") {
if (s == "twelve") {
word[c] = 44;
c++;
return 0;
}
if(s == "thirteen") {
if (s == "thirteen") {
word[c] = 69;
c++;
return 0;
}
if(s == "fourteen") {
if (s == "fourteen") {
word[c] = 96;
c++;
return 0;
}
if(s == "fifteen") {
if (s == "fifteen") {
word[c] = 25;
c++;
return 0;
}
if(s == "sixteen") {
if (s == "sixteen") {
word[c] = 56;
c++;
return 0;
}
if(s == "seventeen") {
if (s == "seventeen") {
word[c] = 89;
c++;
return 0;
}
if(s == "eightteen") {
if (s == "eightteen") {
word[c] = 24;
c++;
return 0;
}
if(s == "nineteen") {
if (s == "nineteen") {
word[c] = 61;
c++;
return 0;
@ -101,15 +101,15 @@ int getst(string s, long long &c) {
int main(void) {
string getit[6];
for (int i = 0 ; i < 6 ; i++) {
for (int i = 0; i < 6; i++) {
cin >> getit[i];
if (getit[i][getit[i].size()-1] == '.') {
getit[i].erase(getit[i].size()-1,1);
if (getit[i][getit[i].size() - 1] == '.') {
getit[i].erase(getit[i].size() - 1, 1);
}
getst(getit[i] , c);
getst(getit[i], c);
}
sort(word , word + c);
for(int i = 0 ; i < c ; i++) {
sort(word, word + c);
for (int i = 0; i < c; i++) {
out += word[i];
out *= 100;
}

View File

@ -23,7 +23,7 @@ void dfs(int x, int y) {
int main() {
cin >> n >> m >> t >> sx >> sy >> fx >> fy;
for(int i = 0 ; i < t ; i++) {
for (int i = 0; i < t; i++) {
int x, y;
cin >> x >> y;
vis[x][y] = -1;

View File

@ -5,14 +5,14 @@
using namespace std;
int main() {
int n, m, a[100005], minn=100000, t=0;
int n, m, a[100005], minn = 100000, t = 0;
cin >> n >> m;
for(int i = 1 ; i <= n ; i++) {
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for(int i = 1 ; i <= n-m+1 ; i++) {
for(int j = 1 ; j <= m ; j++) {
t += a[i+j-1];
for (int i = 1; i <= n - m + 1; i++) {
for (int j = 1; j <= m; j++) {
t += a[i + j - 1];
}
minn = min(t, minn);
t = 0;

View File

@ -1,12 +1,12 @@
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
int main() {
unsigned long long x, n, ans=1;
unsigned long long x, n, ans = 1;
cin >> x >> n;
for(unsigned long long i = 0 ; i < n ; i++) {
ans += ans*x;
for (unsigned long long i = 0; i < n; i++) {
ans += ans * x;
}
cout << ans << endl;
return 0;

View File

@ -32,8 +32,7 @@ int main() {
if (d >= 365) {
ans++;
}
}
else {
} else {
m++;
}
}

View File

@ -15,11 +15,9 @@ int main() {
int p = lower_bound(a, a + m, q) - a;
if (p == m) {
ans += q - a[m - 1];
}
else if (p == 0) {
} else if (p == 0) {
ans += a[0] - q;
}
else {
} else {
ans += min(abs(a[p] - q), abs(q - a[p - 1]));
}
}

View File

@ -16,7 +16,7 @@ void dfs(int cnt, int k, int last) {
return;
}
int i = last;
while (i*i*i*i <= n - cnt) {
while (i * i * i * i <= n - cnt) {
i++;
}
while (i >= last) {

View File

@ -8,10 +8,10 @@ int main() {
int n, a[11] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
scanf("%d", &n);
do {
for (int i = 0; i < n-1; i++) {
for (int i = 0; i < n - 1; i++) {
printf("%5d", a[i]);
}
printf("%5d\n", a[n-1]);
printf("%5d\n", a[n - 1]);
} while (next_permutation(a, a + n));
return 0;
}

View File

@ -4,7 +4,7 @@
using namespace std;
int x = 0, y = 0, t = 0;
int x = 0, y = 0, t = 0;
string s;
int main() {

View File

@ -3,9 +3,9 @@
using namespace std;
int main() {
int n;
int n;
set<string> disk;
string s, dir;
string s, dir;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;

View File

@ -1,4 +1,4 @@
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
@ -7,22 +7,22 @@ const int fib[] = {0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610,
int main() {
int t, n;
cin >> t;
while(t--) {
while (t--) {
stack<int> st;
cin >> n;
cout << n << "=";
for(int i = 45 ; i > 0 ; i--) {
while(n >= fib[i]) {
for (int i = 45; i > 0; i--) {
while (n >= fib[i]) {
n -= fib[i];
st.push(fib[i]);
}
if(n == 0) {
if (n == 0) {
break;
}
}
cout << st.top();
st.pop();
while(!st.empty()) {
while (!st.empty()) {
cout << "+" << st.top();
st.pop();
}

View File

@ -8,12 +8,11 @@ int num[26] = {1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3,
// a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v. w, x, y, z
int main() {
char c;
int cnt = 0;
int cnt = 0;
while (scanf("%c", &c) != EOF) {
if (c == ' ') {
cnt++;
}
else if('a' <= c && c <= 'z') {
} else if ('a' <= c && c <= 'z') {
cnt += num[c - 'a'];
}
// cout << c << ' ' << cnt << endl;

View File

@ -5,9 +5,9 @@ int n, m, k, x, y, o, p, ans = 0;
int dx1[13] = {2, 0, -2, 0, 1, 1, 1, 0, 0, 0, -1, -1, -1};
int dy1[13] = {0, 2, 0, -2, 0, 1, -1, 1, 0, -1, 0, 1, -1};
int dx2[25] = {-2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2};
int dy2[25] = {-2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0,
1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2};
0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2};
int dy2[25] = {-2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0,
1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2};
int main() {
cin >> n >> m >> k;
int a[n + 5][n + 5];

View File

@ -9,12 +9,12 @@ void dfs(string pre, string in) {
return;
}
char root = pre[0];
int k = in.find(root);
int k = in.find(root);
pre.erase(pre.begin());
string leftpre = pre.substr(0, k);
string leftpre = pre.substr(0, k);
string rightpre = pre.substr(k);
string leftin = in.substr(0, k);
string rightin = in.substr(k + 1);
string leftin = in.substr(0, k);
string rightin = in.substr(k + 1);
dfs(leftpre, leftin);
dfs(rightpre, rightin);
post.push_back(root);

View File

@ -30,8 +30,7 @@ int main() {
cin >> l >> r;
if (l > m || r > m || l < 1 || r < 1) {
cout << "Crossing the line" << endl;
}
else {
} else {
cout << ans[r] - ans[l - 1] << endl;
}
}

View File

@ -2,7 +2,6 @@
using namespace std;
long long n, m, l, r, ans, a[1000005];
bool check(long long x) {
@ -25,8 +24,7 @@ int main() {
long long mid = l + r >> 1;
if (check(mid)) {
l = (ans = mid) + 1;
}
else {
} else {
r = mid - 1;
}
}

View File

@ -29,8 +29,7 @@ int main() {
mid2 = r - (r - l) / 3.0;
if (check(mid1) > check(mid2)) {
l = mid1;
}
else {
} else {
r = mid2;
}
}

View File

@ -3,7 +3,7 @@
using namespace std;
int main() {
int n, a[100005];
int n, a[100005];
queue<int> q;
cin >> n;
for (int i = 0; i < n; i++) {

View File

@ -3,7 +3,7 @@
using namespace std;
string s;
int st, cnt = 0, a[1000005], ans[1000005];
int st, cnt = 0, a[1000005], ans[1000005];
int main() {
cin >> s >> st;
@ -23,11 +23,9 @@ int main() {
}
if (ans[3] == 1 && ans[2] == 0 && ans[1] == 0) {
cout << 100 << endl;
}
else if ((ans[2] + ans[3]) % 10) {
} else if ((ans[2] + ans[3]) % 10) {
cout << (ans[2] + ans[3]) % 10 << (ans[1] + ans[2]) % 10 << endl;
}
else {
} else {
cout << (ans[1] + ans[2]) % 10 << endl;
}
return 0;

View File

@ -13,8 +13,7 @@ void merge_sort(long long a[], long long l, long long r) {
while (i <= mid && j <= r) {
if (a[i] <= a[j]) {
t[k++] = a[i++];
}
else {
} else {
t[k++] = a[j++];
ans += (mid - i + 1);
}

View File

@ -5,9 +5,9 @@
using namespace std;
string cnm() {
int n;
char ch;
string s = "";
int n;
char ch;
string s = "";
string str = "";
while (cin >> ch) {
@ -17,11 +17,9 @@ string cnm() {
while (n--) {
s += str;
}
}
else if (ch == ']') {
} else if (ch == ']') {
return s;
}
else {
} else {
s += ch;
}
}

View File

@ -7,8 +7,7 @@ extern "C" int Chtholly(int n, int OvO) {
if (Seniorious(mid) >= 0) {
ans = mid;
r = mid - 1;
}
else {
} else {
l = mid + 1;
}
mid = l + r >> 1;

View File

@ -2,7 +2,7 @@
using namespace std;
int n, m, k, ans, l, a[1005], d[1005], c[1005][1005], f[1005];
int n, m, k, ans, l, a[1005], d[1005], c[1005][1005], f[1005];
bool v[1005][1005];
int dfs(int x) {
@ -26,14 +26,13 @@ int main() {
for (int j = a[1]; j < a[a[0]]; j++) {
if (a[l] == j) {
l++;
}
else {
} else {
for (int k = 1; k <= a[0]; k++) {
if (!v[a[k]][j]) {
int t = a[k];
c[t][0]++;
c[t][c[t][0]] = j;
v[t][j] = 1;
v[t][j] = 1;
}
}
}

View File

@ -84,12 +84,10 @@ signed main() {
if (op == 1) {
cin >> k;
modify(1, x, y, k, 0);
}
else if (op == 2) {
} else if (op == 2) {
cin >> k;
modify(1, x, y, 1, k);
}
else if (op == 3) {
} else if (op == 3) {
cout << query(1, x, y) % p << endl;
}
}

View File

@ -37,8 +37,10 @@ void modify(int u, int x, int d) {
return;
}
int mid = tr[u].l + tr[u].r >> 1;
if (x <= mid) modify(u << 1, x, d);
else modify(u << 1 | 1, x, d);
if (x <= mid)
modify(u << 1, x, d);
else
modify(u << 1 | 1, x, d);
pushup(u);
}
@ -60,8 +62,7 @@ int main() {
cin >> op >> a >> b;
if (op == 'x') {
modify(1, a, b);
}
else if (op == 'y') {
} else if (op == 'y') {
cout << query(1, a, b) << endl;
}
}

View File

@ -21,18 +21,16 @@ struct node {
int main() {
long long op;
node ans;
node ans;
set<node> a;
while (cin >> op, op != -1) {
if (op == 1) {
long long w, c;
cin >> w >> c;
a.insert(node(w, c));
}
else if (op == 2 && !a.empty()) {
} else if (op == 2 && !a.empty()) {
a.erase(--a.end());
}
else if (op == 3 && !a.empty()) {
} else if (op == 3 && !a.empty()) {
a.erase(a.begin());
}
}

View File

@ -8,7 +8,7 @@ string s;
int main() {
cin >> m >> s;
for (int i = 0; i < s.size(); i++) {
if(s[i] == '0') {
if (s[i] == '0') {
continue;
}
if (i != 0) {

View File

@ -3,7 +3,7 @@
using namespace std;
vector<int> l[100010];
int n, m, f, s, ans, pd[100010];
int n, m, f, s, ans, pd[100010];
void dfs(int x) {
for (int y = 0; y < l[x].size(); y++) {

View File

@ -3,7 +3,7 @@
using namespace std;
int main() {
int n, t, m;
int n, t, m;
vector<int> nums;
cin >> n >> m;
for (int i = 0; i < n; i++) {
@ -15,8 +15,7 @@ int main() {
vector<int>::iterator it = lower_bound(nums.begin(), nums.end(), t);
if (*it == t) {
cout << it - nums.begin() + 1 << ' ';
}
else {
} else {
cout << "-1 ";
}
}

View File

@ -80,20 +80,16 @@ int main() {
if (op == 1) {
cin >> x >> y >> k;
modify(1, x, y, k);
}
else if(op == 2) {
} else if (op == 2) {
cin >> k;
modify(1, 1, 1, k);
}
else if(op == 3) {
} else if (op == 3) {
cin >> k;
modify(1, 1, 1, -k);
}
else if(op == 4) {
} else if (op == 4) {
cin >> x >> y;
cout << query(1, x, y) << endl;
}
else if(op == 5) {
} else if (op == 5) {
cout << query(1, 1, 1) << endl;
}
}

View File

@ -1,19 +1,17 @@
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if(n <= 8) {
if (n <= 8) {
cout << 0 << endl;
}
else if(n == 9) {
} else if (n == 9) {
cout << 8 << endl;
}
else {
} else {
cout << 72;
for(int i = 10 ; i < n ; i++) {
for (int i = 10; i < n; i++) {
cout << 0;
}
cout << endl;

View File

@ -4,7 +4,7 @@ using namespace std;
int main() {
short a[1000005];
int n, m;
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> a[i];

View File

@ -7,10 +7,10 @@ int n, a[10];
void dfs(int x, int depth, int last) {
if (x > n) return;
if (x == n) {
for(int i = 1 ; i < depth - 1 ; i++) {
for (int i = 1; i < depth - 1; i++) {
cout << a[i] << '+';
}
cout << a[depth-1] << endl;
cout << a[depth - 1] << endl;
return;
}
for (int i = last; i < n; i++) {

View File

@ -1,4 +1,4 @@
#include<bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
@ -7,51 +7,38 @@ int main() {
cin >> T;
if (T == 1) {
cout << "I love Luogu!";
}
else if (T == 2) {
} else if (T == 2) {
cout << 2 + 4 << " " << 10 - 2 - 4;
}
else if (T == 3) {
} else if (T == 3) {
cout << 3 << endl
<< 12 << endl
<< 2 << endl;
}
else if (T == 4) {
} else if (T == 4) {
printf("%.3lf\n", 500.0 / 3.0);
}
else if (T == 5) {
} else if (T == 5) {
cout << 15 << endl;
}
else if (T == 6) {
} else if (T == 6) {
cout << sqrt(6 * 6 + 9 * 9) << endl;
}
else if (T == 7) {
} else if (T == 7) {
cout << 110 << endl
<< 90 << endl
<< 0 << endl;
}
else if (T == 8) {
} else if (T == 8) {
cout << 3.141593 * 5 * 2 << endl
<< 3.141593 * 5 * 5 << endl
<< 4.0 / 3 * 3.141593 * 5 * 5 * 5 << endl;
}
else if (T == 9) {
} else if (T == 9) {
cout << 22 << endl;
}
else if (T == 10) {
} else if (T == 10) {
cout << 9 << endl;
}
else if (T == 11) {
} else if (T == 11) {
cout << 100.0 / (8 - 5) << endl;
}
else if (T == 12) {
} else if (T == 12) {
cout << 13 << endl
<< "R" << endl;
}
else if (T == 13) {
} else if (T == 13) {
cout << floor(pow((3.141593 * 4 * 4 * 4 * 4 / 3 + 3.141593 * 10 * 10 * 10 * 4 / 3), 1.0 / 3)) << endl;
}
else if (T == 14) {
} else if (T == 14) {
cout << 50 << endl;
}
return 0;

Some files were not shown because too many files have changed in this diff Show More