We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4bdd0bc commit cddea54Copy full SHA for cddea54
B_Sum_of_Digits.cpp
@@ -0,0 +1,33 @@
1
+////https://codeforces.com/contest/102/problem/B
2
+#include <bits/stdc++.h>
3
+using namespace std;
4
+typedef long long ll;
5
+const int mod = 1e9 + 7;
6
+const int N = 1e5 + 5;
7
+
8
+void solve()
9
+{
10
+ string s;
11
+ cin >> s;
12
+ int count = 0;
13
14
+ while (s.size() > 1)
15
+ {
16
+ ll sum = 0;
17
+ for (char c : s)
18
19
+ sum += c - '0';
20
+ }
21
+ count++;
22
23
+ s = to_string(sum);
24
25
+ cout << count << endl;
26
+}
27
28
+int main()
29
30
+ ios_base::sync_with_stdio(0);
31
+ cin.tie(0);
32
+ solve();
33
0 commit comments