Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
Ac Pythoh 3.9 | eremeev.me.2012@gmail.com | 1283. Гномик | 8 мар 2024 18:55 | 1 |
a , b , c = list(map(int , input().split())) y = 0 if a <= b: print(0) exit(0) while True: y+=1 if a - (a / 100 *c) > b: a-= a / 100 *c else: break print(y)
|
Что курил, автор, лол? :DDD | D4nick | 1283. Гномик | 13 окт 2020 01:25 | 1 |
|
If you have WA3(C++) | Vikono | 1283. Гномик | 2 июл 2020 00:41 | 1 |
Just use double type instead int |
Что не правильно? паскаль | Lena | 1283. Гномик | 7 дек 2018 22:02 | 2 |
var a,b,c,i,k:real; begin read(a,b,c); while a>b do begin a:=a-(a*c/100); I:=i+1; end; write(i); end. variable i should be integer ! |
What's wrong? | Markfryazino | 1283. Гномик | 7 дек 2018 21:58 | 2 |
Here is the code (python 3.6). Can anyone explain, why it fails on test 9? import math string = input().split() start = int(string[0]) end = int(string[1]) commission = int(string[2]) if start <= end: n = 0 else: q = 1 - commission / 100 n = math.log((end / start), q) n = round(n) print(n) Use float / double instead of int ! |
accepted | Mikhail | 1283. Гномик | 12 май 2018 20:39 | 1 |
//#pragma GCC optimize("Ofast,no-stack-protector") //#pragma GCC target("avx") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; using namespace std;
#define re return #define pb push_back #define eb emplace_back #define all(x) (x).begin(), (x).end() #define fi first #define se second #define sqrt(x) sqrt(abs(x)) #define mp make_pair #define pi (3.14159265358979323846264338327950288419716939937510) #define fo(i, n) for(int i = 0; i < n; ++i) #define ro(i, n) for(int i = n - 1; i >= 0; --i) #define unique(v) v.resize(unique(all(v)) - v.begin())
template <class T> T abs (T x) { re x > 0 ? x : -x; } template <class T> T sqr (T x) { re x * x; } template <class T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; } template <class T> int sgn (T x) { re x > 0 ? 1 : (x < 0 ? -1 : 0); }
typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<string> vs; typedef double D; typedef long double ld; typedef long long ll; typedef pair<ll, ll> pll; typedef vector<ll> vll; typedef unsigned long long ull; typedef tree <pair<int, char>, null_type, less<pair<int, char>>, rb_tree_tag, tree_order_statistics_node_update> _tree; int main() { ld a, b, c; cin >> a >> b >> c; c = (100 - c) / 100; int ans = 0; while (a > b) { a *= c; ++ans; } cout << ans << endl; //cout << a * pow(1 - (ld) c / 100, 687) << endl; } /////////// Однако я вывел более умное решение если дано M N x, то через k дней количество денег будет равно M * (1 - x / 100) ^ (k - 1) можно написать бинарный поиск, но похоже из-за точности это падает Edited by author 12.05.2018 20:40 |
Easy problem if you just know formulas with percentages | IlushaMax | 1283. Гномик | 18 апр 2017 21:43 | 1 |
|
test 11 ......sad.... | xinxin | 1283. Гномик | 8 окт 2016 19:08 | 1 |
#include<iostream> using namespace std; int main() { double a,b,c,d,e,f=0; cin>>a>>b>>c; d=a*c*0.01; e=a-d; a=e; if(a<=b) { cout<<f; return 0; } f++; while(a>b) { d=a*c*0.01; e=a-d; a=e; f++; } cout<<f; return 0;} |
Can it be solved using integers only? | Outermeasure | 1283. Гномик | 12 авг 2014 13:04 | 1 |
|
wa 7 | Mikron | 1283. Гномик | 4 сен 2013 01:11 | 2 |
wa 7 Mikron 12 июл 2013 19:08 why wa #7 please help( #include <stdio.h> int main(void) { int s; int p; float zo; int t = 0; scanf("%f",&zo); scanf("%d",&s); scanf("%d",&p); while(zo>s){ zo -= zo*p/100; ++t; } printf("%d",t);
return 0; } use float instead of int for s and you will get AC |
note for WA#1 | hoan | 1283. Гномик | 7 авг 2013 18:36 | 3 |
use ( > ), and don't use ( >= ). GOOD LUCK |
Why the answer is wrong??? | Kamaldinov Dmitry | 1283. Гномик | 13 окт 2012 22:18 | 1 |
#include <iostream> using namespace std; int main() { int a, c, b, year; double a1, b1, c1; cin >> a >> b >> c; a1=static_cast <double>(a); if(a1<=1024*1024*1024*2-1 && b<=1024*1024*1024*2-1 && c>=1 && c<=100 && a>0 && b>0) { for(year=1; a1=a1*(100-c)/100; year++) { if (a1<=b) { cout << year; break; } } } cin.get(); cin.get(); return 0; }
|
question2 | sklyack | 1283. Гномик | 14 мар 2012 16:32 | 2 |
What output on test like this: 10 0 50 ? In this case it seems the dwarf will never die. They can't live without gold. :))I think that the limit is at least 1. :D |
Main Loop. Solution is AC | [kernel_panic] | 1283. Гномик | 31 окт 2009 23:20 | 1 |
/*...code...*/ while(N>=M) { N=((100-c)/100)*N; age++; } /*...code...*/ |
What can be on WA#4 | Nilrem | 1283. Гномик | 10 окт 2009 04:09 | 4 |
#include <stdio.h> #include <math.h> int main() { float a,b,c; int i; scanf("%f %f %f",&a,&b,&c); i=log(b/a)/log((100-c)/100)+1; printf("%d",i); } it's simple code fails on fourth test... (WA#4) What can it be ? Here is my code: Program Acm_Timus_1283; var i,k0,km:longint; n,log:real; begin Readln(k0,km,n); n:=(100-n)/100; log:=((ln(km)-ln(k0))/ln(n)); i:=trunc(log); if log-trunc(log)>0.0000000001 then inc(i); Writeln(i); end. Wa#4 too((( I had WA4 too. But then found my mistake(noting to do with precision, actually:)). The thing is that if first number is less or equal that the second then 0 should be output. I suo=ppose your program outputs a negative number:) No doubt, if the dwarf has less money than he should have for his life not to be senseless, he doesn't live at all. When I corrected this mistake, i got AC instead WA#4. |
Wrong Russian text again | Fyodor Menshikov | 1283. Гномик | 7 окт 2009 18:44 | 5 |
In English: When the amount of gold in a pot becomes less than or equal to a certain level In Russian: Kogda u gnomika ostayotsya menshe opredelyonnogo kolichestva zolota Of course "<=" is not the same as "<". Why should I watch the forum for clarification after wa1? Why the statement can't include the clarification? In the worst case Timus team must change English statement to make it equal to Russian. But much better is to change Russian one. Only one word "menshe" should be changed to "ne bol'she". I agree with Fyodor Menshikov. I also had WA at test #1, then I watched the forum and saw this message. After changing "<" to "<=" I got AC. Judges, change russian text, please! i have got wa in my program was this code if (a<b) { printf("0\n"); return 0; } if (a==b) { printf("1\n"); return 0; } when i change it to if (ai<=bi) { printf("0\n"); return 0; } A have got AC. Russian text of statement is wrong! Yeap! I used '<' and got WA#1. Later, I sent writeln(0) and got WA#3! See this: 1462633 17:46:11 Alexander Kouprin 1283 Pascal Accepted 0.015 212 Kb 1462628 17:42:07 Alexander Kouprin 1283 Pascal Wrong answer 3 0.001 212 Kb 1462627 17:42:00 Alexander Kouprin 1283 Pascal Wrong answer 1 0.015 212 Kb 1462626 17:41:52 Alexander Kouprin 1283 Pascal Wrong answer 1 0.001 212 Kb 1462625 17:40:33 Alexander Kouprin 1283 Pascal Wrong answer 1 0.001 212 Kb 1462605 17:09:50 Alexander Kouprin 1283 Pascal Wrong answer 1 0.001 208 Kb 1462604 17:09:40 Alexander Kouprin 1283 Pascal Wrong answer 1 0.001 208 Kb 1460473 00:27:36 Alexander Kouprin 1283 Pascal Wrong answer 1 0.015 188 Kb 1460469 00:26:48 Alexander Kouprin 1283 Pascal Wrong answer 1 0.001 188 Kb 1460465 00:23:58 Alexander Kouprin 1283 Pascal Wrong answer 1 0.015 184 Kb 1460464 00:22:51 Alexander Kouprin 1283 Pascal Wrong answer 1 0.001 184 Kb 1460463 00:22:38 Alexander Kouprin 1283 Pascal Wrong answer 1 0.001 184 Kb 1447763 21:15:09 Alexander Kouprin 1283 Pascal Wrong answer 1 0.001 204 Kb 1447760 21:11:38 Alexander Kouprin 1283 Pascal Wrong answer 1 0.001 204 Kb 1441129 01:43:11 Alexander Kouprin 1283 Pascal Wrong answer 1 0.001 200 Kb 1441127 01:42:55 Alexander Kouprin 1283 Pascal Wrong answer 1 0.001 200 Kb 1441059 23:55:39 Alexander Kouprin 1283 Pascal Wrong answer 1 0.001 200 Kb 1441058 23:55:25 Alexander Kouprin 1283 Pascal Wrong answer 1 0.001 200 Kb ----------------- I tried to solve it more than 15 days!!! http://acm.timus.ru/status.aspx?space=1&num=1283&author=49370 Edited by author 23.03.2007 20:08 |
Please correct problem statement | Fyodor Menshikov | 1283. Гномик | 2 янв 2009 00:16 | 2 |
Первое число — количество золота в гномьем горшочке в начальный момент времени (целое, в граммах). Второе число — количество золота, при котором жизнь гномика лишается смысла (целое, в граммах, не превышает 2^31 − 1). Ограничение для первого числа (2^31 − 1) хорошо бы задать так же, как сейчас задано для второго. Это относится как к русской, так и к английской версии. |
No subject | Liceum#64_Yurik | 1283. Гномик | 20 дек 2008 23:02 | 4 |
Why my program have WA on ! test????? I had the same problem and it was because of i output 1 for the case that amount of gold is less than limit. с натуральным логарифмом не работает Эмуляция рулит Is there in Turbo Pascal logarithm function??? |
Why this idea gives WA#1!! | Bobur | 1283. Гномик | 13 окт 2008 03:28 | 1 |
this is geometrik progress. read(s, min, p); q := 1-p/100; then.. B[n]=b[1]*q^(n-1) that's why min < s*q^(n-1) q^(n-1)>min/s q < 1 then ln(q)<0 n-1 < ln(min/s)/ln(q); n < ln(min/s)/ln(q)+1 |
If you get WA#1 | TimoX | 1283. Гномик | 9 окт 2008 16:34 | 2 |
See there: Sum of gnom's money must be bigger!!! bigger that sum when hi die. Not equal. Good luck! ;) Thank you very much! I got WA 1 and then, when I exchanged the symbol >= to > I got AC :D |