Skip to content

Commit c32fe55

Browse files
committed
done
1 parent d190820 commit c32fe55

File tree

7 files changed

+53
-22
lines changed

7 files changed

+53
-22
lines changed

CF1.cpp

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,35 @@ int main()
2929
cin >> tc;
3030
while (tc--)
3131
{
32-
double r, b, d;
33-
cin >> r >> b >> d;
34-
double less = (r > b) ? b : r;
35-
double big = (r > b) ? r : b;
36-
if (ceil((big - less) / less) > d)
32+
ll n, x;
33+
cin >> n >> x;
34+
ll arr[n];
35+
ll sum = 0;
36+
for (ll i = 0; i < n; i++)
37+
{
38+
cin >> arr[i];
39+
sum += arr[i];
40+
}
41+
if (sum == x)
3742
cout << "NO" << endl;
3843
else
44+
{
3945
cout << "YES" << endl;
46+
ll currsum = 0;
47+
for (ll i = 0; i < n; i++)
48+
{
49+
currsum += arr[i];
50+
if (currsum == x)
51+
{
52+
cout << arr[i + 1] << " " << arr[i] << " ";
53+
i++;
54+
}
55+
else
56+
{
57+
cout << arr[i] << " ";
58+
}
59+
}
60+
cout << endl;
61+
}
4062
}
4163
}

CF1.exe

125 Bytes
Binary file not shown.

CF2.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ GitHub: https://github.com/Hard-Coder05
1717
cout.tie(NULL);
1818
using namespace std;
1919
typedef long long ll;
20+
bool isPerfectSquare(long double x)
21+
{
22+
if (x >= 0)
23+
{
24+
long long sr = sqrt(x);
25+
return (sr * sr == x);
26+
}
27+
return false;
28+
}
2029
int main()
2130
{
2231
FIO;
@@ -28,9 +37,9 @@ int main()
2837
cin >> tc;
2938
while (tc--)
3039
{
31-
ll n, m, k;
32-
cin >> n >> m >> k;
33-
if (((n - 1) + n * (m - 1)) == k)
40+
long double n;
41+
cin >> n;
42+
if (isPerfectSquare(n / 2) || isPerfectSquare(n / 4))
3443
cout << "YES" << endl;
3544
else
3645
cout << "NO" << endl;

CF2.exe

1.12 KB
Binary file not shown.

CF4.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,26 @@ GitHub: https://github.com/Hard-Coder05
77
*/
88
#include <bits/stdc++.h>
99
#define endl "\n"
10-
#define max(a, b) (a < b ? b : a)
11-
#define min(a, b) ((a > b) ? b : a)
10+
#define max(a, b) (a < b ? b : a)
11+
#define min(a, b) ((a > b) ? b : a)
1212
#define MOD 1000000007
1313
#define INF 1000000000000000003
14-
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
14+
#define FIO \
15+
ios_base::sync_with_stdio(false); \
16+
cin.tie(NULL); \
17+
cout.tie(NULL);
1518
using namespace std;
1619
typedef long long ll;
17-
int main() {
20+
int main()
21+
{
1822
FIO;
1923
#ifndef ONLINE_JUDGE
2024
freopen("input.txt", "r", stdin);
2125
freopen("output.txt", "w", stdout);
2226
#endif
2327
ll tc;
2428
cin >> tc;
25-
while (tc--) {
26-
29+
while (tc--)
30+
{
2731
}
2832
}

input.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1+
4
2+
2
3+
4
14
6
2-
1 1 0
3-
2 2 2
4-
2 2 3
5-
2 2 4
6-
1 4 3
7-
100 100 10000
5+
1

output.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
YES
2-
NO
32
YES
43
NO
5-
YES
64
NO

0 commit comments

Comments
 (0)