Skip to content

Commit

Permalink
Update Roadmap atcoder
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanashii76 authored Feb 19, 2024
1 parent 08582fa commit 125b8d7
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 0 deletions.
17 changes: 17 additions & 0 deletions roadmap_atcoder/abc204_b.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <bits/stdc++.h>

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;

}
38 changes: 38 additions & 0 deletions roadmap_atcoder/abc205_b.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include <bits/stdc++.h>


bool compare(std::vector<int> v, int n) {

std::vector<int> 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<int> 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;

}
23 changes: 23 additions & 0 deletions roadmap_atcoder/abc206_c.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <bits/stdc++.h>
#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<ll, ll> 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;


}
27 changes: 27 additions & 0 deletions roadmap_atcoder/abc220_a.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <bits/stdc++.h>


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;

}
28 changes: 28 additions & 0 deletions roadmap_atcoder/abc220_c.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <bits/stdc++.h>

typedef long long ll;

int main() {

ll n, k, sum = 0, aux;
std::cin >> n;

std::vector<ll> 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;

}
14 changes: 14 additions & 0 deletions roadmap_atcoder/abc240_a.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <bits/stdc++.h>

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;


}

0 comments on commit 125b8d7

Please sign in to comment.