File tree Expand file tree Collapse file tree 4 files changed +61
-0
lines changed
Expand file tree Collapse file tree 4 files changed +61
-0
lines changed Original file line number Diff line number Diff line change 1+ ABEL
2+ ABEL
3+ CAIN
4+ JUSTO
5+ ABEL
Original file line number Diff line number Diff line change 1+ 1
2+ 1 0
3+ 100
4+ 3
5+ 1 2 -1 0
6+ 1000
7+ 3
8+ 1 2 -1 1
9+ 1000
10+ 1
11+ 3 -1
12+ 10000
13+ 1
14+ 3 -1
15+ 2
16+ 20
Original file line number Diff line number Diff line change 1+ // https://www.aceptaelreto.com/problem/statement.php?id=103
2+ #include < bits/stdc++.h>
3+
4+ using namespace std ;
5+ const int N = 20 ;
6+ int p[N], n;
7+
8+ double f (double x) {
9+ double sum = 0 ;
10+ for (int i = 0 ; i <= n; i++) {
11+ double exp = 1 ;
12+ for (int j = 0 ; j < i; j++) exp *= x;
13+ sum += exp * p[i];
14+ }
15+ if (sum < 0 ) return 0 ;
16+ if (sum > 1 ) return 1 ;
17+ return sum;
18+ }
19+
20+ int main () {
21+ cin.tie (0 ), ios::sync_with_stdio (0 );
22+ while (1 ) {
23+ int m;
24+ cin >> n;
25+ if (n == 20 ) break ;
26+ for (int i = 0 ; i <= n; i++) cin >> p[n - i];
27+ cin >> m;
28+ double area = 0 ;
29+ for (int i = 0 ; i < m; i++) {
30+ double x = 1 / double (m);
31+ area += x * f (x * i);
32+ }
33+ if (area - 0.5 > 0.001 ) cout << " CAIN\n " ;
34+ else if (0.5 - area > 0.001 )
35+ cout << " ABEL\n " ;
36+ else
37+ cout << " JUSTO\n " ;
38+ }
39+ }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ There are solutions for the following
661 . [ 100 - Constante de Kaprekar] ( 100.cc ) ([ problem site] ( https://www.aceptaelreto.com/problem/statement.php?id=100 ) )
771 . [ 101 - Cuadrados diabólicos y esotéricos] ( 101.cc ) ([ problem site] ( https://www.aceptaelreto.com/problem/statement.php?id=101 ) )
881 . [ 102 - Encriptación de mensajes] ( 102.cc ) ([ problem site] ( https://www.aceptaelreto.com/problem/statement.php?id=102 ) )
9+ 1 . [ 103 - Problemas de Herencia] ( 103.cc ) ([ problem site] ( https://www.aceptaelreto.com/problem/statement.php?id=103 ) )
9101 . [ 114 - Último dígito del factorial] ( 114.cc ) ([ problem site] ( https://www.aceptaelreto.com/problem/statement.php?id=114 ) )
10111 . [ 116 - ¡Hola mundo!] ( 116.cc ) ([ problem site] ( https://www.aceptaelreto.com/problem/statement.php?id=116 ) )
11121 . [ 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