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 f22e190

Browse files
new problem solved
1 parent 7a89191 commit f22e190

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

‎Online Judges/URI/1936.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <iostream>
2+
#include <map>
3+
4+
using namespace std;
5+
6+
map<int, int> ma {
7+
{1,1},
8+
{2,2},
9+
{3,6},
10+
{4,24},
11+
{5,120},
12+
{6,720},
13+
{7,5040},
14+
{8,40320}
15+
};
16+
17+
int main() {
18+
int a, i = 8, cont = 0;
19+
cin >> a;
20+
int sum = a;
21+
while(sum) {
22+
if (ma.at(i) > sum) {
23+
i--;
24+
} else if (ma.at(i) == a) {
25+
cont++; break;
26+
} else {
27+
sum-=ma.at(i);
28+
cont++;
29+
}
30+
}
31+
32+
cout << cont << endl;
33+
return 0;
34+
}
35+

0 commit comments

Comments
(0)

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