Search is not available for this dataset
name
stringlengths
2
88
description
stringlengths
31
8.62k
public_tests
dict
private_tests
dict
solution_type
stringclasses
2 values
programming_language
stringclasses
5 values
solution
stringlengths
1
983k
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int x, p; cin >> x >> p; assert(p == 100); cout << p / 2 << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main(void) { int x, p; cin >> x >> p; if (p != 100) return 0; cout << (x % 2 == 0 ? x / 2 : x / 2 + 1) << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int x, p; int main() { cin >> x >> p; time_t start = clock(); int total = 0; int num = 0; while ((double)(clock() - start) / CLOCKS_PER_SEC < 1.95) { int a = x; int b = 0; int count = 0; while ((double)(clock() - start) / CLOCKS_PER_SEC < 1.95) { count++; if (rand() % 100 < p) { a--; } else { a++; } if (count >= a) break; } if ((double)(clock() - start) / CLOCKS_PER_SEC < 1.95) { num++; total += count; } } cout << fixed << setprecision(6) << (double)total / num << endl; return (0); }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const double EPS = 1e-8; const int inf = 1e8; int main() { int x; double p; cin >> x >> p; vector<double> dp(401); dp[x] = 1; double out = 0; for (int i = 0; i < 400; i++) { vector<double> ndp(400); for (int j = i + 1; j < 400; j++) { if (j) ndp[j - 1] += dp[j] * p / 100; if (j != 399) ndp[j + 1] += dp[j] * (100 - p) / 100; } dp = ndp; for (int j = 0; j < i + 2; j++) out += dp[j] * (i + 1); } cout << fixed << setprecision(9) << out << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; const int INF = 1 << 29; const double EPS = 1e-8; long long x; double p; void update_prop_list(list<double>& prop) { double left = 0; prop.push_back(0); for (double& e : prop) { double copy = e; e = (1 - p) * left + p * e; left = copy; } } int main() { cin >> x >> p; p /= 100; assert(x <= 10); list<double> prop(1, 1); long long y = (x + 1) / 2; for (long long t = 1; t <= y; t++) { update_prop_list(prop); } double ans = 0; for (long long t = y; t < 10000; t++) { ans += t * prop.front(); prop.pop_front(); update_prop_list(prop); } printf("%.8f\n", ans); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20); long long x; cin >> x; double p; cin >> p; if (p == 100) { x++; cout << x / 2 << endl; return 0; } p /= 100.0; if (x % 2 == 0) { cout << x / 2.0 / p << "\n"; } else { x++; cout << x / 2.0 / p + 1 << "\n"; } }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> int x, p; int main(void) { scanf("%d%d", &x, &p); int ans = x / 2; if (x % 2 == 1) { ans++; } if (ans == 0) { ans = 1; } printf("%d\n", ans); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const double EPS = 1e-8; const int inf = 1e8; int main() { int x; double p; cin >> x >> p; if (p == 100) { cout << (x + 1) / 2 << endl; return 0; } vector<double> dp(2000); dp[x - 1] = 1; double out = 0; for (int i = 0; i < 2000; i++) { vector<double> ndp(2000); for (int j = i; j < 2000; j++) { if (j > i) ndp[j - 1] += dp[j] * p / 100; else out += dp[i] * p / 100; if (j != 1999) ndp[j + 1] += dp[j] * (100 - p) / 100; } dp = ndp; for (int j = 0; j < i + 1; j++) out += dp[j] * (i + 1); } cout << fixed << setprecision(9) << out << endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") using namespace std; using ll = long long; using ld = long double; using uint = unsigned int; using ull = unsigned long long; template <typename T> using pair2 = pair<T, T>; using pii = pair<int, int>; using pli = pair<ll, int>; using pll = pair<ll, ll>; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template <class T> inline T gcd(T a, T b) { while (b) { a %= b; swap(a, b); } return a; } template <class T> inline T lcm(T a, T b) { return a * b / gcd(a, b); } clock_t startTime; double getCurrentTime() { return (double)(clock() - startTime) / CLOCKS_PER_SEC; } const ll INF = (ll)1e18; ll MOD; ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; } ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; } ll mul(ll x, ll y) { return (x * y) % MOD; } ll bin_pow(ll x, ll p) { if (p == 0) return 1; if (p & 1) return mul(x, bin_pow(x, p - 1)); return bin_pow(mul(x, x), p / 2); } const int N = 2000100; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); startTime = clock(); ld p, ans = 0; ll x; cin >> x >> p; p /= 100; if (x % 2 == 0) { ans = 1.0 * x / 2 * p; } else { ans = 1.0 + (1 - p) * (x + 1) / 2 / p + (x - 1) / 2; } cout << setprecision(10) << ans << '\n'; ; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
#include <bits/stdc++.h> int main() { int n, m; scanf("%d %d", &n, &m); if (m == 100) printf("%d\n", (n + 1) / 2); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int x, p; cin >> x >> p; if (p == 100) { int tim = (x + 1) / 2; cout << tim << endl; } double pp = p / 100.0; if (x % 2) { printf("%.14f\n", (double)(1 - pp) / pp + 1 + (double)(x / 2) / pp); } else printf("%.14f\n", (double)(x / 2) / pp); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const double eps = 1e-10; const double pi = acos(-1.0); const double inf = (int)1e8; int main() { long long x, p; std::cin >> x >> p; x++; if (x % 2 == 0) std::cout << x / 2 << ".00000000" << std::endl; else std::cout << x / 2 << ".50000000" << std::endl; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; using ll = long long; template <class T> bool set_min(T &a, const T &b) { return a > b ? a = b, true : false; } template <class T> bool set_max(T &a, const T &b) { return a < b ? a = b, true : false; } template <class T> istream &operator>>(istream &is, vector<T> &v) { for (T &a : v) is >> a; return is; } template <class T> ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) os << "\t" << t; return os << endl; } template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; } const int INF = 1 << 30; const ll INFL = 1LL << 60; class Solver { public: bool solve() { int x; cin >> x; double p; cin >> p; if (abs(100 - p) > 1e-6) return 0; cout << x / 2 + x % 2 << endl; return 0; } }; int main() { cin.tie(0); ios::sync_with_stdio(false); Solver s; s.solve(); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
$0=($1+$1%2)*50/$2
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
UNKNOWN
say-get+>1*100/-get
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int x, p; cin >> x >> p; if (p == 100) { int tim = (x + 1) / 2; cout << tim << endl; } if (x % 2) { printf("%.14f\n", (double)(1 - p) / p + (double)x / p); } else printf("%.14f\n", (double)x / p); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; const int INF = 1 << 29; const double EPS = 1e-9; const ll MOD = 1000000007; const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1}; ll X, P; int main() { cin >> X >> P; double res = X / 2 + (X % 2); printf("%.20lf\n", res); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; const int INF = 1 << 29; const double EPS = 1e-9; const ll MOD = 1000000007; const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1}; ll X, P; const int MAX_TURN = 300; const int MAX_POS = 300; double dp[MAX_TURN][MAX_POS][MAX_POS]; bool visited[MAX_TURN][MAX_POS][MAX_POS]; double memo(int turn, int pos_ao, int pos_cho) { if (pos_ao == pos_cho) { return turn; } if (turn >= MAX_TURN or pos_ao < 0 or pos_ao >= MAX_POS or pos_cho < 0 or pos_cho >= MAX_POS) { return INF; } double pro = (double)P / 100; if (visited[turn][pos_ao][pos_cho]) { return dp[turn][pos_ao][pos_cho]; } visited[turn][pos_ao][pos_cho] = true; double result = INF; result = min(result, memo(turn + 1, pos_ao - 1, pos_cho - 1) * pro + memo(turn + 1, pos_ao - 1, pos_cho + 1) * (1 - pro)); result = min(result, memo(turn + 1, pos_ao, pos_cho - 1) * pro + memo(turn + 1, pos_ao, pos_cho + 1) * (1 - pro)); result = min(result, memo(turn + 1, pos_ao + 1, pos_cho - 1) * pro + memo(turn + 1, pos_ao + 1, pos_cho + 1) * (1 - pro)); return dp[turn][pos_ao][pos_cho] = result; } int main() { cin >> X >> P; if (X > 10) return 0; int geta = MAX_POS / 2; double result = memo(0, geta, X + geta); printf("%.20lf\n", result); return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int X, P; signed main() { ios::sync_with_stdio(false); cin.tie(0); cin >> X >> P; if (P == 100) { cout << (X + 1) / 2 << "\n"; } return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; template <class S, class T> istream& operator>>(istream& is, pair<S, T>& p) { return is >> p.first >> p.second; } const double EPS = 1e-10; const double PI = acos(-1.0); const long long MOD = 1e9 + 7; double C[1010][1010]; double ps[1010], qs[1010]; int main() { cin.tie(0); ios_base::sync_with_stdio(false); long long x, p; cin >> x >> p; if (p == 100) { cout << (x + 1) / 2 << endl; return 0; } if (x > 10) return 1; ps[0] = qs[0] = 1.; for (int i = (0); i < (1000); ++i) { ps[i + 1] = ps[i] * p / 100.; qs[i + 1] = qs[i] * (100 - p) / 100.; } for (int i = 1; i < 1000; ++i) { C[i][0] = ps[i]; C[i][i] = qs[i]; for (int j = 1; j < i; ++j) C[i][j] = C[i - 1][j] * qs[1] + C[i - 1][j - 1] * ps[1]; } const int MAX = 10020; vector<vector<double>> xs(2, vector<double>(MAX)); int crt = 0, nxt = 1; xs[crt][MAX / 2 + x] = 1.; int px = MAX / 2; double ans = 0.; for (int t = (0); t < (MAX / 2 - 20); ++t) { fill((xs[nxt]).begin(), (xs[nxt]).end(), 0); for (int a = (0); a < (MAX); ++a) { if (a - 1 >= 0) xs[nxt][a - 1] += xs[crt][a] * p / 100.; if (a + 1 < MAX) xs[nxt][a + 1] += xs[crt][a] * (100. - p) / 100.; } swap(crt, nxt); if (xs[crt][px] < EPS && xs[crt][px - 1] < EPS && xs[crt][px + 1] < EPS) ++px; else if (xs[crt][px] > xs[crt][px - 1] && xs[crt][px] > xs[crt][px + 1]) ; else if (xs[crt][px - 1] > xs[crt][px] && xs[crt][px - 1] > xs[crt][px + 1]) --px; else if (xs[crt][px + 1] > xs[crt][px - 1] && xs[crt][px + 1] > xs[crt][px]) ++px; ans += (t + 1) * xs[crt][px]; xs[crt][px] = 0.; } cout << fixed << setprecision(9) << ans << endl; return 0; }
p03901 CODE FESTIVAL 2016 Elimination Tournament Round 2 (Parallel) - Takahashi is Missing!
Aoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki. Time is divided into turns. In each turn, Aoki and Takahashi take the following actions simultaneously: * Let the current coordinate of Aoki be a, then Aoki moves to a coordinate he selects from a-1, a and a+1. * Let the current coordinate of Takahashi be b, then Takahashi moves to the coordinate b-1 with probability of p percent, and moves to the coordinate b+1 with probability of 100-p percent. When the coordinates of Aoki and Takahashi coincide, Aoki can find Takahashi. When they pass by each other, Aoki cannot find Takahashi. Aoki wants to minimize the expected number of turns taken until he finds Takahashi. Find the minimum possible expected number of turns. Constraints * 1 ≦ x ≦ 1,000,000,000 * 1 ≦ p ≦ 100 * x and p are integers. Input The input is given from Standard Input in the following format: x p Output Print the minimum possible expected number of turns. The output is considered correct if the absolute or relative error is at most 10^{-6}. Examples Input 3 100 Output 2.0000000 Input 6 40 Output 7.5000000 Input 101 80 Output 63.7500000
{ "input": [ "6\n40", "101\n80", "3\n100" ], "output": [ "7.5000000", "63.7500000", "2.0000000" ] }
{ "input": [], "output": [] }
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const double eps = 1e-10; const int inf = 1000000009; int i, j, k, m, n, l, x, p; int ans; int main() { cin >> x >> p; if (p == 100) { cout << (x + 1) / 2 << endl; return 0; } return 0; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python2
#encoding=utf-8 inp = input() x = 100000 for i in xrange(inp): x = x * 1.05 if int(x % 1000) != 0: x += 1000 - int(x % 1000) print int(x)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
import math n = int(input()) a = 100000 for _ in range(n): a *= 1.05 a = 1000 * math.ceil(a / 1000) print(a)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python2
n=int(raw_input()) g,r=100000,1.05 for i in range(n): g*=r if int(g)%1000>0: g=(int(g)/1000)*1000+1000 print g
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); double ans=100000; for(int i=0;i<n;i++){ ans=ans*1.05; if(ans%1000!=0){ ans=ans+1000-ans%1000; } } int a=(int)ans; System.out.println(a); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <stdio.h> #include <string.h> int main(){ int n; scanf("%d", &n); int m = 100000; for(int i=0;i<n;i++){ m *= 1.05; if(m%1000 != 0) m = (m/1000+1)*1000; } printf("%d\n", m); }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python2
a = input() ret = 100000 while 0<a: ret *= 1.05 if(ret%1000): ret = int((ret//1000+1)*1000) a -= 1 print ret
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; int main(){ int i,n=100000,m; cin >> i; while(i--){ n+=n*0.05; m=n%1000; if(m){ n+=1000-m; } } cout << n << endl; return 0; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
import sys import math n = int(input()) debt = 100000 for i in range(1,n+1): debt = math.ceil((debt*1.05)/1000)*1000 print(debt)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); double debt = 100000; int N = in.nextInt(); for(int i=0;i<N;i++){ debt = Math.ceil(debt*1.05/1000)*1000; } System.out.printf("%.0f\n",debt); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<string> using namespace std; int main() { int n; float b=100000; cin>>n; for(int i=0;i<n;i++){ b*=1.05; b=(int)((b+999)*0.001); b*=1000; } cout<<(int)b<<endl; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <string> using namespace std; int main() { int m = 100000, n; cin >> n; for (int i = 0; i < n; i++) { m *= 1.05; if(m%1000) m += 1000 - m % 1000; } cout << m << endl; return 0; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <string> using namespace std; int main(){ int n; cin >> n; int a; a=100000; int b; b=0; while(b<n){ a=a/20*21; if((a%1000)!=0){a=a/1000*1000+1000;} b=b+1;} cout << a<<endl; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.PrintWriter; import java.util.*; import static java.lang.Math.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); PrintWriter out=new PrintWriter(System.out); double money = 100000; final double tax = 1.05; int n= sc.nextInt(); for(int i=0;i<n;i++){ money*=tax; money/=1000; money=ceil(money); money*=1000; } out.println((int)money); out.flush(); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<stdio.h> int main() { int n; long long int s=100000; scanf("%d",&n); for(int i=0;i<n;i++){ s*=1.05; s+=999; s/=1000; s*=1000; } printf("%d\n",s); return 0; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
import math debt = 100000 rate = 1.05 week = int(input()) for i in range(week): debt = math.ceil(debt*1.05/1000)*1000 print(debt)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; int main(){ int n,i; double m=100.0; cin>>n; for(i=0;i<n;i++){ m*=1.05; if(m-(int)m>0.0){ m+=1.0; m=(int)m; } } cout<<m<<"000"<<endl; return 0; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll n, res = 100000; cin >> n; while (n--) { res = (res + res / 20 + 999) / 1000 * 1000; } cout << res << endl; return 0; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
from math import ceil n=int(input()) d=int(1e5) for x in range(n): d=(1.05*d) d=int(int(ceil(d/1e3))*1e3) print(d)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); double p = 100000; int n = s.nextInt(); for(int i = 0; i < n; ++i) { p *= 1.05; p = Math.ceil(p / 1000) * 1000; } System.out.println((int)p); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int sum = 100000; double debt = sum * 0.05; for (int i = 0; i < n; i++) { sum += debt; if (sum % 1000 != 0) { sum -= sum % 1000; sum += 1000; } debt = sum * 0.05; } System.out.println(sum); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.*; public class Main{ public static void main(String argv[]) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); int weeks = Integer.parseInt(line); float debt = 100000; for(int i=0; i<weeks; i++){ debt *= 1.05f; if((debt % 1000) > 0.0){ debt = debt+1000-debt%1000; } } System.out.print(Integer.toString((int)debt)+"\n"); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
x=int(input()) i=0 a=100000 while x>i : a=a+a*0.05 if a%1000!=0 : a=a+1000 a=int(a/1000) a=a*1000 i=i+1 print(a)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
import math debt = 100000 n = int(input()) for w in range(n): debt *= 1.05 debt = math.ceil(debt / 1000) * 1000 print(debt)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
import math n = int(input()) money = 100000 for i in range(n): money = money*1.05 money = math.ceil(money/1000)*1000 print(money)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
x = 100000 n = int(input()) for _ in range(n): x = x*1.05 if x%1000>0: x = x-x%1000+1000 print(int(x))
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> using namespace std; double money = 100000; int i; int main() { cin>>i; for(i;i>0;--i) { money *= 1.05; money = (long)(money/1000+0.99)*1000; } printf("%.0lf\n",money); }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
public class Main { static java.util.Scanner scan = new java.util.Scanner(System.in); public static void main(String[] args) { int input = scan.nextInt(); double total = 100; while (0 < input--) { total = Math.ceil(total * 1.05); } total *= 1000; print((int) total); } public static void print(Object out) { System.out.println(out); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<stdio.h> int main(void){ int n,i,x=100000,z; scanf("%d",&n); for(i=0;i<n;i++) { x = x * 1.05; if(x % 1000 != 0.0) { z = (x / 1000)+1; x = z * 1000; } } printf("%d\n",x); return 0; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
n = int(input()) d = 100000 for i in range(n): d *= 1.05 d = d - (d - 1) % 1000 + 999 print(int(d))
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <stdio.h> int main(){ int i,n,debt = 100000; scanf("%d",&n); for(i = 0;i < n;i++){ debt = (((int)(debt * 1.05) - 1) / 1000 + 1) * 1000; } printf("%d\n",debt); }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.*; import static java.lang.System.*; public class Main { Scanner sc = new Scanner(in); void run() { int n = sc.nextInt(); int m = 100000; for (int i = 0; i < n; i++) { m += (int)Math.ceil(m*0.05/1000)*1000; } out.println(m); } public static void main(String[] args) { new Main().run(); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
import math debt = 100000 for n in range(int(input())): debt = math.ceil(debt*1.05/1000)*1000 print(str(debt))
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
n=int(input()) x=100000 for i in range(n): x*=1.05 if x%1000>0: x=x-(x%1000)+1000 else: pass print(int(x))
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python2
def f(a,b): if (b == 0): return a a = a * 1.05 if (a%1000 != 0): a = a - a%1000 + 1000 return f(a,b-1) print int(f(100000,input()))
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader( new InputStreamReader(System.in)); int v = Integer.parseInt(br.readLine()); int m = 100000; for (int i = 0; i < v; i++) { m *= 1.05; if ((m % 1000) > 0) { m += 1000 - m % 1000; } } System.out.println(m); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.*; import java.math.*; public class Main { public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); double money = 100.00; for(int i=0; i<n; i++){ money = money*1.05; BigDecimal tmp = new BigDecimal(money); money = tmp.setScale(0,BigDecimal.ROUND_UP).doubleValue(); } System.out.println((int)money*1000); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <stdio.h> int main(void) { int n; int ans = 100000; scanf("%d", &n); for (int i = 0; i < n; i++){ ans += ans * 0.05; ans = (ans + 999) / 1000 * 1000; } printf("%d\n", ans); return (0); }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python2
import math as k n=input() m=105 for i in range(n-1): m=k.ceil(m*1.05) print int(m*1000)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int money = 100; for (int i = 0; i < n; i++){ double x = (double)money * 1.05; money = (int)(Math.ceil(x)); } System.out.println(money * 1000); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
n = int(input()) amount = 100000 for i in range(n): amount = int(-(-amount * 1.05 // 1000) * 1000) print(amount)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
import math debt = 100000 n = int(input()) for i in range(n): debt *= 1.05 debt = math.ceil(debt * 0.001)*1000 print(debt)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cmath> using namespace std; int main() { int n; cin >> n; int ans = 100000; for (int i = 0; i < n; i++) ans = ceil(ans * 1.05 / 1000) * 1000; cout << ans << endl; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
s=100000 n=int(input()) for i in range (n): s*=1.05 if s%1000!=0: s=s-(s%1000)+1000 print(int(s))
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Scanner; public class Main{ static int debt(int n){ int x = 100000; while( n > 0 ){ x *= (1 + 0.05); if( x%1000 != 0 ){ x = x - x%1000 + 1000; } n--; } return x; } public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); int n = stdIn.nextInt(); System.out.println(debt(n)); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
n=int(input()) s=100000 for i in range(n): s*=1.05 p=s%1000 if p!=0: s+=1000-p print(int(s))
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int debt=100000; int n=sc.nextInt(); for(int i=0;i<n;i++){ debt=(int)Math.ceil((debt*1.05)/1000)*1000; } System.out.println(debt); sc.close(); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
n=int(input()) a=100000 for i in range(n): a=a*1.05 if a%1000 != 0: a=int(a//1000*1000+1000) print(a)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> using namespace std; int main(){ int n; cin>>n; int lend=100000; for(int i=1;i<=n;i++){ lend=(lend*1.05-1)/1000; lend=(lend+1)*1000; } cout<<lend<<endl; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int week = scan.nextInt(); double debt = 100000; for(int i = 0; i < week; i++){ debt = debt * 1.05 / 1000; debt = Math.ceil(debt); debt = debt * 1000; } int ans = (int)debt; System.out.println(ans); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python2
import math n = int(raw_input()) debt = 100000 for i in range(n): debt = int(math.ceil(debt * 1.05 / 1000)) * 1000 print debt
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include "bits/stdc++.h" using namespace std; int main() { long long int N; cin >> N; long long int num = 100; while (N--) { num =num* 1.0499999999+1; } cout << num * 1000 << endl; return 0; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Scanner; class Main{ public static void main(String[] args){ final Scanner sc=new Scanner(System.in); int syakkin=100000; int n=sc.nextInt(); for(int i=0;i<n;i++){ syakkin*=1.05; if(syakkin%1000!=0){ syakkin=((syakkin/1000)+1)*1000; } } System.out.println(syakkin); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python2
#!/usr/bin/python # -*- coding: utf-8 -*- import math result = 100000 num = int(raw_input()) for i in range(num): result *= 1.05 result /= 1000 result = math.ceil(result) result *= 1000 print int(result)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
import math n = eval(input()) yen = 100000 for i in range(n): yen += yen * 0.05 yen = int(math.ceil(yen / 1000.0) * 1000) print(yen)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
import math v = int(input()) cal = 100000 for w in range(v): cal = math.ceil(cal * 1.05 * 0.001) * 1000 print("%d" % cal)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<stdio.h> int main(){ int n,i,a,b,c; std::cin>>a; for(n=0,i=100000;a>n;++n){ i=i+i/20; if(i%1000!=0){ b=i%1000; i=i+1000-b; } } std::cout<<i<<std::endl; return 0; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int a=sc.nextInt(); int money=100000; for(int i=0;i<a;i++){ money*=1.05; int amari=money%1000; money-=amari; money+=amari==0 ? 0 : 1000; } System.out.println(money); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
import math debt = 100 n = int(input()) for _ in range(n): debt = math.ceil(debt * 1.05) print(debt * 1000)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int y = 100000; for(int i = 0 ; i < n ; i++){ y = y * 105 / 100; if( y % 1000 ) y += 1000 - y % 1000; } cout << y << endl; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Scanner; public class Main { private static final int origin = 100000; private static final double interest = 1.05; static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int num = sc.nextInt(); double ans = origin; for(int count = 0; count < num; count++) { ans = ans * interest / 1000; ans = Math.ceil(ans) * 1000; } System.out.println((int)ans); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Scanner; public class Main { /** * @param args */ public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int money = 100; for (int i = 0; i < n; i++) { money = (int) Math.ceil(money * 1.05); } System.out.println(money * 1000); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python2
import math debt = 100000 for i in range(int(raw_input())): debt = int(math.ceil((debt * 1.05) / 1000)) * 1000 print debt
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; int main() { int m = 100000; int n; cin >> n; for(int i=0; i<n; i++) { m += m / 20; if(m % 1000 != 0) m = (m / 1000 + 1) * 1000; } printf("%d\n", m); }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int s=0; int a=100000; while (s<n){ s++; a=a+a*0.05; a=((a+999)/1000)*1000; } printf("%d\n",a); }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
import math N = int(input()) A = 100000 for _ in range(N): A = A * 1.05 A = (int(math.ceil(A / 1000))) * 1000 print(A)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Scanner; class Main { public static void main(String[] args) { int weeks = new Scanner(System.in).nextInt(); double debt = 100000; for(int i = 0; i < weeks;i++) { debt *= 1.05; double fraction = debt % 1000; if (fraction != 0)debt += 1000 - fraction; } System.out.println((long)debt); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
a = 100000; n = int(input()) while n > 0: n -= 1 a = a + (a * 5) // 100 a = ((a - 1) // 1000 + 1) * 1000 # 1000未満の切り上げ print(a)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <stdio.h> int main() {int kane=100000,N;scanf("%d",&N);while (N--) {kane=kane+kane/20;int rest=kane%1000;if (rest) kane+=(1000-rest);}printf("%d\n",kane);return 0;}
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n, debt = 100000; n = sc.nextInt(); for(int i = 0; i < n; i++){ debt *= 1.05; if(debt % 1000 != 0){ debt += 1000 - debt % 1000; } } System.out.println(debt); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python2
n = int(raw_input()) debt=100000 for i in range(n): debt*=1.05 if debt % 1000 != 0: debt = (int(debt / 1000)+1) * 1000 else: debt = int(debt) print debt
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; int main() { int n; int m = 100000; cin >> n; for(int i = 0; i < n; i++){ m += m / 20; if(m % 1000){ m += 1000 - m % 1000; } } cout << m << endl; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> #include <cmath> using namespace std; int main() { int n; double s = 100000; cin >> n; while(n--) s = ceil(s * 1.05 * 0.001) * 1000; cout << (int)s << endl; return 0; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include<iostream> #include<cmath> using namespace std; int main(){ float base = 100; int n; cin >> n; for(int i = 0; i < n; i++){ base *= 1.05; base = ceil(base); } cout << (int)(base*1000) << endl; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
a=100000 for _ in range(int(input())): a=((a*1.05)//1000+1)*1000 if (a*1.05)%1000 else a*1.05 print(int(a))
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
x=100000 for i in range(int(input())): x*=1.05 if x%1000!=0: x+=1000-x%1000 print(int(x))
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
java
import java.util.Scanner; public class Main { public static void main(String[] args) { double debt = 100000; Scanner stdIn = new Scanner(System.in); int n = Integer.parseInt(stdIn.next()); for (int i = 1; i <= n; i++) { debt += (debt * 0.05); int tmp = (int)(debt / 1000); if((debt/1000) != tmp) debt = ((tmp*1000) + 1000); } System.out.println((long)debt); } }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; int main() { int n, k = 100000; cin >> n; for (int i = 1; i <= n; i++) { k = static_cast<int>(k * 1.05 + 999) / 1000 * 1000; } cout << k << endl; return 0; }
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
python3
import math n = int(input()) a = 100 for i in range(n): a = math.ceil(a*1.05) print(a*1000)
p00007 Debt Hell
Your friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week. Write a program which computes the amount of the debt in n weeks. Input An integer n (0 ≤ n ≤ 100) is given in a line. Output Print the amout of the debt in a line. Example Input 5 Output 130000
{ "input": [ "5" ], "output": [ "130000" ] }
{ "input": [], "output": [] }
CORRECT
cpp
#include <iostream> using namespace std; int main(){ int n; int debt = 100000; cin >> n; for(int i=0; i<n;i++){ debt *= 1.05; if(debt % 1000) debt += (1000-(debt % 1000)); } cout << debt << endl; }