File tree Expand file tree Collapse file tree 4 files changed +43
-0
lines changed
Expand file tree Collapse file tree 4 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ Mayor
2+ Mayor
3+ Menor
4+ Mayor
5+ Mayor
6+ Menor
Original file line number Diff line number Diff line change 1+ 10 3
2+ 750 2
3+ 65535 2
4+ 65535 3
5+ 10000 2
6+ 99999 1
7+ 0 0
Original file line number Diff line number Diff line change 1+ // https://www.aceptaelreto.com/problem/statement.php?id=106
2+ #include < bits/stdc++.h>
3+
4+ using namespace std ;
5+ const int N = 100000 ;
6+ bool composite[N];
7+ int pi[N];
8+
9+ int main () {
10+ cin.tie (0 ), ios::sync_with_stdio (0 );
11+ for (int i = 4 ; i < N; i += 2 ) composite[i] = 1 ;
12+ for (int i = 3 ; i < N; i += 2 )
13+ if (!composite[i])
14+ for (int j = i * 2 ; j < N; j += i) composite[j] = 1 ;
15+ for (int i = 2 ; i < N; i++) pi[i] = pi[i - 1 ] + !composite[i];
16+ int n, m;
17+ while (1 ) {
18+ cin >> n >> m;
19+ if (!n && !m) break ;
20+ double error = pi[n] / double (n) - 1 / log (double (n));
21+ if (error < 0 ) error = -error;
22+ for (int i = 0 ; i < m; i++) error *= 10 ;
23+ if (error == 1 ) cout << " Igual\n " ;
24+ else if (error < 1 )
25+ cout << " Menor\n " ;
26+ else
27+ cout << " Mayor\n " ;
28+ }
29+ }
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ There are solutions for the following
10101 . [ 104 - Móviles] ( 104.cc ) ([ problem site] ( https://www.aceptaelreto.com/problem/statement.php?id=104 ) )
11111 . [ 105 - Ventas] ( 105.cc ) ([ problem site] ( https://www.aceptaelreto.com/problem/statement.php?id=105 ) )
12121 . [ 106 - Códigos de barras] ( 106.cc ) ([ problem site] ( https://www.aceptaelreto.com/problem/statement.php?id=106 ) )
13+ 1 . [ 107 - Aproximación de Gauss] ( 107.cc ) ([ problem site] ( https://www.aceptaelreto.com/problem/statement.php?id=107 ) )
13141 . [ 114 - Último dígito del factorial] ( 114.cc ) ([ problem site] ( https://www.aceptaelreto.com/problem/statement.php?id=114 ) )
14151 . [ 116 - ¡Hola mundo!] ( 116.cc ) ([ problem site] ( https://www.aceptaelreto.com/problem/statement.php?id=116 ) )
15161 . [ 192 - Por 3 o más 5] ( 192.cc ) ([ problem site] ( https://www.aceptaelreto.com/problem/statement.php?id=192 ) )
You can’t perform that action at this time.
0 commit comments