diff --git a/roadmap_atcoder/abc204_b.cpp b/roadmap_atcoder/abc204_b.cpp new file mode 100644 index 0000000..f9d01b6 --- /dev/null +++ b/roadmap_atcoder/abc204_b.cpp @@ -0,0 +1,17 @@ +#include + +int main(void) { + + int n, aux, sum = 0; + + std::cin >> n; + + for(int i = 0; i < n; ++i) { + std::cin >> aux; + if (aux > 10) + sum += aux-10; + } + + std::cout << sum << std::endl; + +} \ No newline at end of file diff --git a/roadmap_atcoder/abc205_b.cpp b/roadmap_atcoder/abc205_b.cpp new file mode 100644 index 0000000..7d12d83 --- /dev/null +++ b/roadmap_atcoder/abc205_b.cpp @@ -0,0 +1,38 @@ +#include + + +bool compare(std::vector v, int n) { + + std::vector s; + for(int i = 1; i <= n; ++i) + s.emplace_back(i); + + for(int i = 0; i < n; ++i) + if(s[i] != v[i]) + return false; + + return true; + +} + + + +int main() { + + int n, aux; + std::cin >> n; + + std::vector v; + for(int i = 0; i < n; ++i) { + std::cin >> aux; + v.emplace_back(aux); + } + + std::sort(v.begin(),v.end()); + + if (compare(v,n)) + std::cout << "Yes" << std::endl; + else + std::cout << "No" << std::endl; + +} \ No newline at end of file diff --git a/roadmap_atcoder/abc206_c.cpp b/roadmap_atcoder/abc206_c.cpp new file mode 100644 index 0000000..72bb1a0 --- /dev/null +++ b/roadmap_atcoder/abc206_c.cpp @@ -0,0 +1,23 @@ +#include +#define ll long long + +int main(void){ + + ll n, ans = 0; + std::cin >> n; + + ll a[n]; + // Don't need use a sort algorithm because of map + std::map m; + for(int i = 0; i < n; ++i) { + std::cin >> a[i]; + m[a[i]]++; + } + + for(int i = 0; i < n; ++i) + ans+=n-i-1-(--m[a[i]]); + + std::cout << ans << std::endl; + + +} \ No newline at end of file diff --git a/roadmap_atcoder/abc220_a.cpp b/roadmap_atcoder/abc220_a.cpp new file mode 100644 index 0000000..2833dac --- /dev/null +++ b/roadmap_atcoder/abc220_a.cpp @@ -0,0 +1,27 @@ +#include + + +int find_multiple (int a, int b, int c) { + + int cons = 1; + + while(c <= b) { + c = cons*c; + if (c >= a && c <= b) + return c; + else + cons++; + } + + return -1; + +} + +int main(void){ + + int a,b,c; + std::cin >> a >> b >> c; + + std::cout << find_multiple(a,b,c) << std::endl; + +} \ No newline at end of file diff --git a/roadmap_atcoder/abc220_c.cpp b/roadmap_atcoder/abc220_c.cpp new file mode 100644 index 0000000..f070a98 --- /dev/null +++ b/roadmap_atcoder/abc220_c.cpp @@ -0,0 +1,28 @@ +#include + +typedef long long ll; + +int main() { + + ll n, k, sum = 0, aux; + std::cin >> n; + + std::vector v; + for(ll i = 0; i < n; ++i) { + std::cin >> aux; + v.emplace_back(aux); + } + + std::cin >> k; + + for(ll i = 0; i < k; ++i) { + sum += v[i%n]; + if(sum > k) { + aux = i; + break; + } + } + + std::cout << aux+1 << std::endl; + +} \ No newline at end of file diff --git a/roadmap_atcoder/abc240_a.cpp b/roadmap_atcoder/abc240_a.cpp new file mode 100644 index 0000000..e66c783 --- /dev/null +++ b/roadmap_atcoder/abc240_a.cpp @@ -0,0 +1,14 @@ +#include + +int main(void) { + + int a,b; + std::cin >> a >> b; + + if (abs(a-b) != 1 && abs(a-b) != 9) + std::cout << "No" << std::endl; + else + std::cout << "Yes" << std::endl; + + +} \ No newline at end of file