diff --git a/Atcoder/abc352/A.cpp b/Atcoder/abc352/A.cpp new file mode 100644 index 0000000..aad06da --- /dev/null +++ b/Atcoder/abc352/A.cpp @@ -0,0 +1,24 @@ +#include +using namespace std; + + +int main() { + + int n, x, y, z; cin >> n >> x >> y >> z; + vector values(n,0); + while(x != y) { + if(x <= y) { + values[x] = 1; + x++; + + } + else { + values[x] = 1; + x--; + } + } + + cout << (values[z] ? "Yes" : "No") << endl; + + return 0; +} \ No newline at end of file diff --git a/Atcoder/abc352/B.cpp b/Atcoder/abc352/B.cpp new file mode 100644 index 0000000..d24cbcf --- /dev/null +++ b/Atcoder/abc352/B.cpp @@ -0,0 +1,18 @@ +#include +using namespace std; + + +int main(){ + + string s, t; cin >> s >> t; + for(int i = 0, j = 0; s[i] != '\0';++j) { + if(s[i] == t[j]) { + cout << j+1 << " "; + i++; + } + } + + cout << endl; + return 0; + +} \ No newline at end of file diff --git a/Atcoder/abc352/C.cpp b/Atcoder/abc352/C.cpp new file mode 100644 index 0000000..5d4ba32 --- /dev/null +++ b/Atcoder/abc352/C.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; + +typedef long long ll; + +bool templateSort(pair a, pair b) { + return a.first > b.first; +} + +int main(){ + + int n; cin >> n; + vector> heights(n+1); + while(n--) { + ll a, b; cin >> a >> b; + heights.emplace_back(make_pair(a,b)); + } + + sort(heights.begin(),heights.end(),templateSort); + int count = heights[0].second; + + for(int i = 1; i < (int)heights.size(); ++i) { + heights[i].first += heights[i-1].first; + heights[i].second += heights[i-1].first; + + if(heights[i].second >= count) + count = heights[i].second; + + } + + cout << count << endl; + return 0; + +} \ No newline at end of file