Skip to content

Commit 70a3b83

Browse files
committed
Improve input/output files
1 parent 5d17038 commit 70a3b83

File tree

4 files changed

+6513
-2
lines changed

4 files changed

+6513
-2
lines changed

solutions/beecrowd/1542/1542.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#include <cmath>
22
#include <cstdint>
3+
#include <iomanip>
34
#include <iostream>
45

56
int main() {
6-
std::int16_t q, d, p, answer;
7+
double q, d, p, answer;
78

89
while (std::cin >> q && q) {
910
std::cin >> d >> p;
1011

11-
answer = trunc(static_cast< double >((q * d) / -(q - p) * p));
12+
answer = trunc(((d * p) / (p - q)) * q);
1213

1314
std::cout << answer << " pagina";
1415
if (answer > 1) {
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
for q in $(seq 1 19); do
6+
for d in $(seq 1 19); do
7+
for p in $(seq 1 19); do
8+
if [[ q -lt p ]]; then
9+
echo "${q} ${d} ${p}"
10+
fi
11+
done
12+
done
13+
done
14+
echo "0"

0 commit comments

Comments
 (0)