Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 89a483b

Browse files
two new problems
1 parent 3f0755b commit 89a483b

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

‎Online Judges/URI/1285.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <iostream>
2+
3+
using namespace std;
4+
5+
bool check_digits(string str) {
6+
for (int i = 0; i < (int)str.size(); i++) {
7+
for (int j = 0; j < (int)str.size(); j++) {
8+
if (str[i] == str[j] && i != j)
9+
return true;
10+
}
11+
}
12+
return false;
13+
}
14+
15+
16+
int main() {
17+
int n, m, cont = 0;
18+
19+
while(cin >> n >> m) {
20+
cont = 0;
21+
for (int i = n; i <= m; i++) {
22+
if (!check_digits(to_string(i)))
23+
cont++;
24+
}
25+
26+
cout << cont << endl;
27+
}
28+
29+
30+
return 0;
31+
}

‎Online Judges/URI/2369.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
#include <iostream>
3+
4+
using namespace std;
5+
6+
int main() {
7+
8+
int n, sum = 7;
9+
cin >> n;
10+
11+
if (n > 10) {
12+
int i = 11;
13+
while(i <= n) {
14+
if (i >= 10 && i <= 30)
15+
sum+=1;
16+
else if (i >= 31 && i <= 100)
17+
sum+=2;
18+
else if (i >= 101)
19+
sum+=5;
20+
i++;
21+
}
22+
23+
}
24+
25+
26+
cout << sum << endl;
27+
return 0;
28+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /