Skip to content

Commit

Permalink
Atcoder contest exercises
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanashii76 authored Feb 20, 2024
1 parent 24299ae commit 9905275
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
29 changes: 29 additions & 0 deletions roadmap_atcoder/ABC083B_Some_Sums.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <bits/stdc++.h>

int digitsSum(int x) {

int sum = 0;

while (x != 0) {
sum += x%10;
x /= 10;
}

return sum;

}

int main(void) {

int n, a ,b;
std::cin >> n >> a >> b;

int sum = 0;

for(int i = 1; i <= n; ++i)
if(digitsSum(i) >= a && digitsSum(i) <= b)
sum += i;

std::cout << sum << std::endl;

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

int main(void) {

int a,b,c,x;
std::cin >> a >> b >> c >> x;
int tot = 0;

// Analizyng until each coin become zero;
for(int i = 0; i <= a; ++i)
for(int j = 0; j <= b; ++j)
for(int k = 0; k <= c; ++k) {
int sum = 500*i + 100*j + 50*k;
if(sum == x)
tot++;
}

std::cout << tot << std::endl;


}

0 comments on commit 9905275

Please sign in to comment.