File tree Expand file tree Collapse file tree 6 files changed +20
-67
lines changed
Expand file tree Collapse file tree 6 files changed +20
-67
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ GitHub: https://github.com/Hard-Coder05
66#############################################
77*/
88#include < bits/stdc++.h>
9-
109#define endl " \n "
1110#define max (a, b ) (a < b ? b : a)
1211#define min (a, b ) ((a > b) ? b : a)
@@ -29,35 +28,5 @@ int main()
2928 cin >> tc;
3029 while (tc--)
3130 {
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)
42- cout << " NO" << endl;
43- else
44- {
45- 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- }
6231 }
6332}
Original file line number Diff line number Diff line change @@ -17,15 +17,6 @@ GitHub: https://github.com/Hard-Coder05
1717 cout.tie(NULL );
1818using namespace std ;
1919typedef 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- }
2920int main ()
3021{
3122 FIO;
@@ -37,11 +28,5 @@ int main()
3728 cin >> tc;
3829 while (tc--)
3930 {
40- long double n;
41- cin >> n;
42- if (isPerfectSquare (n / 2 ) || isPerfectSquare (n / 4 ))
43- cout << " YES" << endl;
44- else
45- cout << " NO" << endl;
4631 }
4732}
Original file line number Diff line number Diff 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 );
1518using namespace std ;
1619typedef 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}
Original file line number Diff line number Diff 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 );
1518using namespace std ;
1619typedef 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}
Original file line number Diff line number Diff line change 1- 4
2- 2
3- 4
4- 6
5- 1
Original file line number Diff line number Diff line change 1- YES
2- YES
3- NO
4- NO
You can’t perform that action at this time.
0 commit comments