Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit eed00b9

Browse files
committedFeb 22, 2022
1637A solved, return 0 added to 2 problems
1 parent 85cbb16 commit eed00b9

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed
 

‎c++/string_of_ints_to_vector.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
// works if you are given the length of the array
5+
int main() {
6+
/*
7+
run for loop with value of n, the cin into
8+
v[i]. This works because C++ interprets spaces
9+
as separators between inputs, just like it
10+
does for newlines.
11+
*/
12+
int n; cin >> n;
13+
vector<int> v(n);
14+
for(int i = 0; i < n; i++) cin >> v[i];
15+
16+
// testing
17+
for(int i : v) cout << i << " -> ";
18+
return 0;
19+
}

‎codeforces/1637A.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int main() {
5+
int t; cin >> t;
6+
7+
while(t--) {
8+
int n; cin >> n;
9+
vector<int> v(n);
10+
for(int i = 0; i < n; i++) cin >> v[i];
11+
bool not_sorted = false;
12+
for(int i = 0; i < n-1; i++)
13+
if(v[i] > v[i+1]) not_sorted = true;
14+
15+
if(not_sorted) cout << "YES\n";
16+
else cout << "NO\n";
17+
}
18+
return 0;
19+
}

‎codeforces/1637A.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
for i in range(int(input())):
2+
n = int(input())
3+
a = list(map(int, input().split()))
4+
if a != sorted(a): print("YES")
5+
else: print("NO")

‎codeforces/339A.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ int main() {
1919
if(i != v.size() - 1)
2020
cout << v[i] << '+';
2121
else cout << v[i];
22+
23+
return 0;
2224

2325
}

‎codeforces/617A.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ int main() {
1010
cout << 1;
1111
else if(x % 5 == 0) cout << x / 5;
1212
else cout << x / 5 + 1;
13+
return 0;
1314
}

0 commit comments

Comments
 (0)
Please sign in to comment.