solution
stringlengths
11
983k
difficulty
int64
0
21
language
stringclasses
2 values
n = input().split() x = int(n[1]) y = int(n[2]) n = int(n[0]) t = n -y res = n * y / 100 if not res == round(res): res = int(res)+1 res = int(-x +res) res = max(res,0) print(res)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.precision(1); cout << fixed; double n, x, y; cin >> n >> x >> y; double s = (y * n) / 100; int p = ceil(s) - x; if (p >= 0) cout << p; else cout << 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); double n, x, y; cin >> n >> x >> y; double needed = ceil(y / 100 * n); if (needed <= x) { cout << 0; } else { cout << needed - x; } }
7
CPP
#include <bits/stdc++.h> using namespace std; int main(int qtd, char* nome[]) { ios::sync_with_stdio(false); cin.tie(0); int n, x, y; cin >> n >> x >> y; int people = ceil(n * y / 100.0); cout << (x >= people ? 0 : people - x) << endl; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; scanf("%d%d%d", &n, &x, &y); int t = x; while (((double)x / n) * 100 < y) { x++; } cout << x - t << endl; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; signed main() { long long n, x, y; cin >> n >> x >> y; long long per = x * 100 / n; long long cnt = x; while (per < y) { cnt++; per = cnt * 100 / n; } cout << cnt - x; }
7
CPP
import sys from functools import reduce from collections import Counter import time import datetime import math # def time_t(): # print("Current date and time: " , datetime.datetime.now()) # print("Current year: ", datetime.date.today().strftime("%Y")) # print("Month of year: ", datetime.date.today().strftime("%B")) # print("Week number of the year: ", datetime.date.today().strftime("%W")) # print("Weekday of the week: ", datetime.date.today().strftime("%w")) # print("Day of year: ", datetime.date.today().strftime("%j")) # print("Day of the month : ", datetime.date.today().strftime("%d")) # print("Day of week: ", datetime.date.today().strftime("%A")) def ip(): return int(sys.stdin.readline()) def sip(): return sys.stdin.readline() def mip(): return map(int,sys.stdin.readline().split()) def mips(): return map(str,sys.stdin.readline().split()) def lip(): return list(map(int,sys.stdin.readline().split())) def matip(n,m): lst=[] for i in range(n): arr = lip() lst.append(arr) return lst def factors(n): # find the factors of a number return list(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))) def minJumps(arr, n): #to reach from 0 to n-1 in the array in minimum steps jumps = [0 for i in range(n)] if (n == 0) or (arr[0] == 0): return float('inf') jumps[0] = 0 for i in range(1, n): jumps[i] = float('inf') for j in range(i): if (i <= j + arr[j]) and (jumps[j] != float('inf')): jumps[i] = min(jumps[i], jumps[j] + 1) break return jumps[n-1] def dic(arr): # converting list into dict of count return Counter(arr) def check_prime(n): if n<2: return False for i in range(2,int(n**(0.5))+1,2): if n%i==0: return False return True # --------------------------------------------------------- # # sys.stdin = open('input.txt','r') # sys.stdout = open('output.txt','w') # --------------------------------------------------------- # n,x,y = mip() a = y*n/100 a = math.ceil(a) if a>x: print(a-x) else: print(0)
7
PYTHON3
a, b, c = map(int, input().split()) a = (c * a + 99) // 100 print(0 if a - b < 0 else a - b)
7
PYTHON3
a, b, c = map(int, input().split()) c/=100 a*=c a*=10 finals = 0 if a%10 > 0: a/=10 finals = int(a)+1 else: a/=10 finals = int(a) if finals <= b: finals = 0 print(finals) else: print(finals-b)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; cin >> n >> x >> y; int sum = n * y; if (sum % 100 == 0) { sum = sum / 100; } else { sum = sum / 100; sum++; } if (sum > x) cout << sum - x << endl; else { cout << 0 << endl; } return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int n, x, y; int bin_search(int l, int r) { while (l != r) { int now = (l + r) / 2; if ((x + now) * 100 / n < y) l = now + 1; else r = now; } return l; } int main() { cin >> n >> x >> y; cout << bin_search(0, n * 100); }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y, j, k, l; cin >> n >> x >> y; l = n * y / 100; if (l * 100 < n * y) l++; k = l - x; if (k > 0) cout << k << endl; else cout << 0 << endl; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; cin >> n >> x >> y; long long per = n * y; if (((x * 100) / n) >= y) { cout << 0; } else { if (per % 100 == 0) per = per / 100; else per = per / 100 + 1; cout << abs(x - per); } }
7
CPP
def wizard(): k = 3 n, x, y = list(map(int,input().strip().split()))[:k] res = int((n*y / 100) + ((n*y % 100) != 0)) - x if res > 0: return res else: return 0 print(wizard())
7
PYTHON3
#include <bits/stdc++.h> int main() { int n, x, y; int s = 0, m = 0; scanf("%i %i %i", &n, &x, &y); if ((n * y) % 100 != 0) { s = ((n * y) / 100) + 1; } else { s = ((n * y) / 100); } if (s - x < 0) { printf("0"); return 0; } printf("%i", s - x); return 0; }
7
CPP
n,w,p=map(int,input().split()) x=(n*p)/100 if x%1==0: if int(x-w)>0: print(int(x-w)) else: print(0) else: if int(x)+1-w>0: print(int(x)+1-w) else: print(0)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; const int OO = (int)2e9; const double PI = 2 * acos(0.0); const double EPS = 1e-9; int dcmp(double a, double b) { return fabs(a - b) <= EPS ? 0 : a > b ? 1 : 2; } int DI[] = {-1, 0, 1, 0, 1, -1, -1, 1}; int DJ[] = {0, 1, 0, -1, 1, -1, 1, -1}; int main() { long long n, m, y; cin >> n >> m >> y; long long need = ceil((double)(y * n) / 100.0); if (m > need) cout << 0 << endl; else cout << need - m << endl; return 0; }
7
CPP
from math import ceil n, x, y = map(int, input().split()) required = ceil(y * n / 100) print(max(0, required - x))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y, k; cin >> n >> x >> y; k = (n * y) / 100 - x; while ((x + k) * 100 < y * n) k++; cout << max(k, 0); return 0; }
7
CPP
#include <bits/stdc++.h> int main() { int i, n, x, y; scanf("%d%d%d", &n, &x, &y); i = (y * n) / 100; if (i >= x) { if (y * n > i * 100) { i++; printf("%d\n", i - x); } else printf("%d\n", i - x); } else printf("0\n"); scanf("%d", &i); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int n, x, y, q; int main() { cin >> n >> x >> y; if (y * n % 100) q = y * n / 100 + 1; else q = y * n / 100; if (q > x) cout << q - x; else cout << 0; return 0; }
7
CPP
P, N , rate = map(int,input().split()) need = P * rate / 100 if (P * rate) % 100 == 0: need = P * rate // 100 else: need = P * rate // 100 + 1 if need > N: print(need - N) else: print(0)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; double a, y, b, x, c; int main() { cin >> a >> b >> c; x = a * (c / 100); if (x > b) cout << ceil(x) - b; else cout << '0'; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; void solve() { long long int a, b, c; cin >> a >> b >> c; long long int x = ceil(a * c * 1.0 / 100); x -= b; if (x < 0) x = 0; cout << x << endl; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); ; long long int t; solve(); return 0; }
7
CPP
l=input() l=l.split() n=int(l[0]) x=int(l[1]) y=int(l[2]) #print((y*n)//100) #print(-(y*n)) #print(-(y*n)//100) divisao inteira em python arredonda pra baixo k=(-(-(y*n)//100)) #print(k) k=k-x if k>=0: print(k) else: print('0')
7
PYTHON3
import math a,b,c=map(int,input().split()) print(math.ceil(-min(0,-a*c/100+b)))
7
PYTHON3
n, x, y = map(int, input().split()) p = 0 for i in range(10**6 + 1): if ( (x + p) / n) >= y / 100: print(p) break p += 1
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int t; t = 1; while (t--) { double n, x, y, k; cin >> n >> x >> y; k = ceil((y / 100) * n) - x; if (k >= 0) cout << k; else cout << 0; } cerr << "Time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl; return 0; }
7
CPP
def main(): [n, x, y] = [int(_) for _ in input().split()] a = n / 100 * y - x if a <= 0: print(0) else: from math import ceil print(ceil(a)) if __name__ == '__main__': main()
7
PYTHON3
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); int main() { int n, x, y; scanf(" %d %d %d", &n, &x, &y); int minimum_necessary = (n * y) / 100; if ((n * y) % 100) minimum_necessary++; int ans = minimum_necessary - x; printf("%d\n", ans < 0 ? 0 : ans); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; cin >> n >> x >> y; double i = (double)(y * n) / (100); int t = int(ceil(i)) - x; if (t > 0) cout << t; else cout << 0; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; struct s1 { int a; int b; }; bool cp(s1 a2, s1 b2) { if (a2.a != b2.a) return a2.a > b2.a; else return a2.b < b2.b; } int main() { float n, x, y, i, buf = 0; float f, d; cin >> n >> x >> y; f = n * y / 100; if (f == int(f)) d = int(f); else d = int(f) + 1; d = d - x; if (d < 0) cout << 0; else cout << d; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; double x, y, n, z, t; int main() { cin >> n >> x >> y; z = x; t = (x / n) * 100; while (t < y) { x++; t = (x / n) * 100; } cout << x - z << endl; }
7
CPP
# Description of the problem can be found at http://codeforces.com/problemset/problem/168/A import math n, x, y = map(int, input().split()) print(max(0, math.ceil((n * y) / 100) - x))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y, need4demon, puppets; cin >> n >> x >> y; need4demon = ceil((y / 100.0) * n); if (x >= need4demon) puppets = 0; else puppets = need4demon - x; cout << puppets << endl; }
7
CPP
n,x,y = input().split() n=int(n) x=int(x) y=int(y) p=(y/100)*n if(p!=int(p)): p=int(p+1) else: p=int(p) r=p-x if(r>=0): print(r) else: print(0)
7
PYTHON3
from math import ceil x, y, percentage = map(int, input().split()) ans = percentage / 100 * x if ans > y: print(ceil(ans - y)) else: print(0)
7
PYTHON3
n , w, p = map(int,input().split()) import math rq = math.ceil((p/100)*n) print(rq-w) if rq-w>0 else print(0)
7
PYTHON3
#include <bits/stdc++.h> const long long INF = 1000000007; const double cp = 2 * asin(1.0); const double eps = 1e-9; const long long mod = 1000000007; using namespace std; int main() { cin.tie(NULL); ios_base::sync_with_stdio(false); int n, x; double y, P; scanf("%d %d %lf", &n, &x, &P); int ans = max(0, (int)(ceil(P / 100.0 * (double)n) + 0.005) - x); printf("%d\n", ans); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d = 0; cin >> a >> b >> c; if ((c * a) % 100 != 0) { d = ((c * a) / 100) + 1; } else if ((c * a) % 100 == 0) { d = ((c * a) / 100); } if (d < b) cout << 0 << endl; else { cout << d - b << endl; } }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { long int n = 0, k = 0, x = 0, y = 0, t = 0; cin >> n >> x >> y; t = (n * y + 100 - 1) / 100; k = t - x; if (k > 0) { cout << k << "\n"; } else { cout << "0\n"; } return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { long long int n, x, y; cin >> n >> x >> y; long long int z = 0.01 * y * n; if ((y * n) % 100 != 0) z += 1; if (x >= z) { cout << 0; return 0; } cout << z - x; return 0; }
7
CPP
from sys import stdin, stdout import math,sys from itertools import permutations, combinations from collections import defaultdict,deque,OrderedDict from os import path import bisect as bi import heapq def yes():print('YES') def no():print('NO') if (path.exists('input.txt')): #------------------Sublime--------------------------------------# sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w'); def I():return (int(input())) def In():return(map(int,input().split())) else: #------------------PYPY FAst I/o--------------------------------# def I():return (int(stdin.readline())) def In():return(map(int,stdin.readline().split())) def main(): try: n,x,y=In() per=math.ceil((y*n)/100) per=x-per if per>=0: print(0) else: print(abs(per)) except: pass M = 998244353 P = 1000000007 if __name__ == '__main__': #for _ in range(I()):main() for _ in range(1):main()
7
PYTHON3
n,x,y = map(int,input().split()) if (n*y)%100==0: if x<((n*y)//100): print((n*y)//100 - x) else: print(0) else: res = ((n*y)//100)+1 if x<res: print(res-x) else: print(0)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { double n, x, y; cin >> n >> x >> y; if (ceil((n * y) / 100) <= x) cout << "0"; else { cout << ceil((n * y) / 100) - x; } }
7
CPP
import math n,x,y=map(int,input().split()) p=math.ceil((y*n)/100) ans=abs(p-x) if p<x: print(0) else: print(ans)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; cin >> n >> x >> y; int people = n - x; int wizards = x; people *= 100; wizards *= 100; int needed = max(0, n * y - wizards); cout << (needed + 99) / 100 << endl; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y, r; cin >> n >> x >> y; r = (n * y + 99) / 100; cout << max(0, r - x) << endl; }
7
CPP
#include <bits/stdc++.h> int main() { int n, x, y, a; double m; scanf("%d%d%d", &n, &x, &y); m = (double)y / 100 * n; a = ceil(m - x); if (a >= 0) printf("%d", a); else printf("0"); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int n, x, y; int main() { scanf("%d%d%d", &n, &x, &y); int need = (n * y / 100) + ((n * y) % 100 == 0 ? 0 : 1); if (need <= x) puts("0"); else printf("%d\n", need - x); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; const int oo = 1e9; const int MAXN = 1e2; int main() { ios::sync_with_stdio(0); int n, x, y; scanf("%d %d %d", &n, &x, &y); printf("%d", max(0, int(ceil(double(n) * y / 100)) - x)); return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; scanf("%d %d %d", &n, &x, &y); int z = (y * n) / 100; if ((double)z < (y / 100.0) * n) { z = z + 1; } int p = 0; while (x + p < z) { p++; } cout << p << endl; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; cin >> n >> x >> y; int num1 = n * y / 100; double num2 = n * y / 100.00; if (num2 > num1) num1++; if (num1 > x) cout << abs(num1 - x) << endl; else cout << 0 << endl; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; void solve() { long double n, x; long double y; cin >> n >> x >> y; long long int req = 0; if (((n * y) / 100 - (int)(n * y) / 100) == 0) { req = (n * y) / 100; } else { req = (n * y) / 100; req += 1; } if (x >= req) cout << 0; else cout << req - x; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long TESTS = 1; while (TESTS--) { solve(); } return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; void fast() { std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); } long long arr1[1000000], arr2[1000000]; string ConverToString(long long n) { string Result; stringstream convert; convert << n; Result = convert.str(); return Result; } long long ConvertToInt(string s) { stringstream geek(s); long long x = 0; geek >> x; return x; } int main() { fast(); int a, b, c, k = 0; cin >> a >> b >> c; int ans = a * c; if (ans % 100 != 0) { k++; } ans = ans / 100; ans = ans - b; ans = ans + k; if ((a * c / 100) - b < 0) ans = 0; cout << ans << "\n"; return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; double N; int X; int main() { cin >> N >> X; double K; cin >> K; int goal = ceil(N * K / 100.0); cout << max(goal - X, 0); }
7
CPP
import math n,x,y = map(int,input().split()) req = int(math.ceil((n*y)/100)) if x>req: print (0) else: print (req-x)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; cin >> n >> x >> y; double tmp = ((double)n * 1.000 * y * 0.01); int r = ceil(tmp); if (r <= x) { cout << "0\n"; } else { cout << (r - x) << endl; } }
7
CPP
from math import ceil n, x, y = list(map(int, input().split())) a = y / 100 * (n) - x if a < 0: print(0) else: print(ceil(a))
7
PYTHON3
import math n,x,y = map(int, input().split()) extraPeopleNeeded = math.ceil(y*n/100) if(extraPeopleNeeded > x): print (extraPeopleNeeded - x) else: print(0)
7
PYTHON3
import math def wizards(n,x,y): percent=math.ceil((n*y)/100) if(percent>x): return(percent-x) else: return(0) n,x,y=list(map(int,input().split())) result=wizards(n,x,y) print(result)
7
PYTHON3
n, x, y = input().split() n, x, y = int(n), int(x), int(y) percent = ((y * n) / 100) if int(percent) != percent: percent += 1 percent = int(percent) ans = int(percent - x) if ans >= 0: print(ans) else: print(0)
7
PYTHON3
n,x,y=map(int,input().split()) d=0 p=(x*100)/n while p<y: d=d+1 x=x+1 p=(x*100)/n print(d)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; template <class T1> inline void debug(T1 _x) { cout << _x << '\n'; } template <class T1, class T2> inline void debug(T1 _x, T2 _y) { cout << _x << ' ' << _y << '\n'; } template <class T1, class T2, class T3> inline void debug(T1 _x, T2 _y, T3 _z) { cout << _x << ' ' << _y << ' ' << _z << '\n'; } template <class T1, class T2, class T3, class T4> inline void debug(T1 _x, T2 _y, T3 _z, T4 _zz) { cout << _x << ' ' << _y << ' ' << _z << ' ' << _zz << '\n'; } template <class T1> inline void debug(T1 _array, int _size) { cout << "["; for (int i = 0; i < _size; ++i) { cout << ' ' << _array[i]; } puts(" ]"); } inline bool CI(int &_x) { return scanf("%d", &_x) == 1; } inline bool CI(int &_x, int &_y) { return CI(_x) && CI(_y); } inline bool CI(int &_x, int &_y, int &_z) { return CI(_x) && CI(_y) && CI(_z); } inline bool CI(int &_x, int &_y, int &_z, int &_zz) { return CI(_x) && CI(_y) && CI(_z) && CI(_zz); } inline void wait(double seconds) { double endtime = clock() + (seconds * CLOCKS_PER_SEC); while (clock() < endtime) { ; } } const double eps = 1e-9; int n, x, y; inline void Read() { CI(n, x, y); } inline string toS(double var) { char _buff[50]; sprintf(_buff, "%.9lf", var); return (string)_buff; } inline void Proc() { long long xtra; for (xtra = 0;; ++xtra) { long long tmp = (xtra + x) * 100.; if (tmp >= ((long long)(y)*n)) break; } cout << xtra; puts(""); } int main() { int tt = 1; for (int i = 1, j1 = tt + 1; i < j1; ++i) { Read(); Proc(); } return 0; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int i, j, m, n, k, x, y; double per; cin >> n >> x >> y; for (i = 0;; i++) { if (floor(100 * ((double)(x + i) / n)) >= y) { cout << i; break; } } return 0; }
7
CPP
import math z=list(map(int,input().split())) n=z[0] x=z[1] y=z[2] c=(x/n) c=c*100 c=round(c,4) if(c>=y): print(0) else: p=(((y-c)*n)/100) print(math.ceil(p))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y, i, j; cin >> n >> x >> y; i = (n * y) / 100; if (y * n != i * 100) i += 1; if (i > x) cout << i - x; else cout << "0"; }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); double i, j, k; cin >> i >> j >> k; double ans = ceil((k * i) / 100); if (j >= ans) cout << 0; else cout << ans - j; return 0; }
7
CPP
#include <bits/stdc++.h> double n, x, y, i; int main() { scanf("%lf%lf%lf", &n, &x, &y); for (;; i += 1.0) { if ((x + i) * 100 / n >= y) { printf("%.0lf", i); break; } } scanf(" "); }
7
CPP
#include <bits/stdc++.h> using namespace std; int main() { int atleast, required; int n, x, y; cin >> n >> x >> y; if (x > (n * y) / 100) required = 0; else { required = (n * y) / 100 - x; if (((n * y) % 100) > 0) required++; } cout << required; }
7
CPP
n,x,y=[int(x) for x in input().strip().split()] def ceil(val): if int(val)==val: return int(val) else: return int(val)+1 num = ceil(n*y/100) count = max(0,num-x) print(count)
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; cin >> n >> x >> y; int porcentaje = ((n * y) + 99) / 100; cout << max(0, porcentaje - x) << '\n'; }
7
CPP
n, x, y = map(int, input().split()) need = round(n * y / 100) + (((n*y/100) > (n*y//100) and round((n*y)/100) < (n*y//100)+1 )) print(max(need - x, 0))
7
PYTHON3
import math arr=list(map(int,input().split())) total=arr[0] wiz=arr[1] per=arr[2] required=math.ceil((total*per)/100) # print("Required: ",required) if required<=wiz: print("0") else: print(required-wiz)
7
PYTHON3
from math import ceil def main(): mode="filee" if mode=="file":f=open("test.txt","r") #f.readline() #input() get = lambda :[int(x) for x in (f.readline() if mode=="file" else input()).split()] [n,x,y]=get() total = ceil((y/100)*n) if total >x: print(total-x) else: print(0) if mode=="file":f.close() if __name__=="__main__": main()
7
PYTHON3
n,x,y=list(map(int,input().split())) print(max((int(n*y/100+.99999)-x),0))
7
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { double A, B, C; double D; cin >> A >> B >> C; double x1, x2; if (!A) { if (!B) { if (!C) { printf("-1"); return 0; } else { printf("0"); return 0; } } else { printf("1\n"); printf("%lf", -C / B); } } else { D = pow(B, 2) - (4 * A * C); if (D < 0) { printf("0"); return 0; } else { D = sqrt(D); } x1 = (-B + D) / (2 * A); x2 = (-B - D) / (2 * A); if (x1 == x2) { cout << "1" << endl; printf("%lf", x1); } else { (x1 > x2) ? printf("2\n%lf\n%lf", x2, x1) : printf("2\n%lf\n%lf", x1, x2); } } }
8
CPP
a, b, c = map(float, input().split()) D = b ** 2 - (4 * a * c) if D < 0: print(0) elif a == 0 and b == 0 and c != 0: print(0) elif a == 0 and b == 0 and c == 0: print(-1) elif a == 0: x0 = c / -(b) print(1) print(x0) elif b == 0: print(1) print(0) elif D == 0 and (a > 0 or a < 0): x = -(b) / (2 * a) print(1) print(x) elif D > 0 and (a > 0 or a < 0): x1 = (-(b) + D ** 0.5) / (2 * a) x2 = (-(b) - D ** 0.5) / (2 * a) print(2) g = [x1, x2] for i in sorted(g): print(i)
8
PYTHON3
s=[int(n) for n in input().split()] if s[0]==0 and s[1]*s[2]!=0: print(1) print(-s[2]/s[1]) elif s[0]*s[1]!=0 and s[2]==0: print(2) a=0 b=-s[1]/s[0] p=[a,b] print('%6f'%min(p)) print('%6f'%max(p)) elif s[0]*s[2]<0 and s[1]==0: print(2) p=[(-s[2]/s[0])**.5,-(-s[2]/s[0])**.5] print('%.6f'%min(p)) print('%.6f'%max(p)) elif s[0]==0 and s[1]==0 and s[2]!=0: print(0) elif s[0]==s[1]==s[2]==0: print(-1) elif s[0]*s[1]*s[2]!=0: if s[1]**2<4*(s[0]*s[2]): print(0) elif s[1]**2==4*(s[0]*s[2]): print(1) print('%.6f'%(-s[1]/(2*s[0]))) else: print(2) j=(-s[1]+(s[1]**2-4*s[0]*s[2])**.5)/(2*s[0]) k=(-s[1]-(s[1]**2-4*s[0]*s[2])**.5)/(2*s[0]) p=[j,k] print("%.6f"%min(p)) print('%.6f'%max(p)) elif s[0]==s[2]==0 and s[1]!=0: print(1) print('%6f'%0) elif s[2]==s[1]==0 and s[0]!=0: print(1) print('%6f'%0) elif s[0]*s[2]!=0 and s[1]==0: if s[0]*s[2]>0: print(0) else: print(2) print('%6f'%-(-s[2]/s[0])**.5) print('%6f'%(-s[2]/s[0])**.5)
8
PYTHON3
a,b,c=map(int,input().split()) if a==0: if b==0: if c==0: print(-1) else: print(0) else: print(1) print(-c/b) else: d=b**2-4*a*c if d>0: x1=(-b-d**0.5)/(2*a) x2=(-b+d**0.5)/(2*a) print(2) if x1<x2: print(x1) print(x2) else: print(x2) print(x1) elif d==0: print(1) print(-b/(2*a)) else: print(0)
8
PYTHON3
import math a, b, c = input().split() a = int(a) b = int(b) c = int(c) if a == 0: if b == 0: if c == 0: print(-1) else: print(0) else: if c == 0: print(1, 0.0, sep="\n") else: print(1, -c / b, sep="\n") else: if c == 0: if b == 0: print(1, 0.0, sep="\n") else: print(2, min(0.0, -b / a), max(0.0, -b / a), sep="\n") else: if b == 0: if c / a > 0: print(0) else: print(2, min(-math.sqrt(-c / a), math.sqrt(-c / a)), max(-math.sqrt(-c / a), math.sqrt(-c / a)), sep="\n") else: if b ** 2 < 4 * a * c: print(0) elif b ** 2 == 4 * a * c: print(1, -b / (2 * a), sep="\n") else: print(2, min((-b - math.sqrt(b ** 2 - 4 * a * c)) / (2 * a), (-b + math.sqrt(b ** 2 - 4 * a * c)) / (2 * a)), max((-b - math.sqrt(b ** 2 - 4 * a * c)) / (2 * a), (-b + math.sqrt(b ** 2 - 4 * a * c)) / (2 * a)), sep="\n")
8
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { double A, B, C; cin >> A >> B >> C; if (A == 0 && B == 0 && C == 0) { cout << "-1"; return 0; } if (A == 0 && B == 0 && C != 0) { cout << "0"; return 0; } if (A == 0) { double z = (-C) / B; printf("1\n%.10lf", z); return 0; } else { double der = (B * B - 4 * A * C); if (der < 0) { cout << 0; return 0; } if (der == 0) { printf("1\n%.10lf", (-B) / (2 * A)); } if (der > 0) { double x1 = (-B + sqrt(der)) / (2 * A), x2 = (-B - sqrt(der)) / (2 * A); double q = min(x1, x2), p = max(x1, x2); printf("2\n%.10lf\n%.10lf", q, p); } } return 0; }
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; if (a == 0) { if (b == 0 && c != 0) cout << 0 << endl; if (b == 0 && c == 0) cout << -1 << endl; if (b != 0 && c == 0) cout << 1 << endl << "0,0000000000" << endl; if (b != 0 && c != 0) { cout << 1 << endl; double x = (double)-c / b; printf("%3.10lf\n", x); } } else { double x, y; if (b * b - 4 * a * c < 0) cout << 0 << endl; if (b * b == 4 * a * c) { cout << 1 << endl; x = (double)-b / (2 * a); printf("%3.10lf\n", x); } if (b * b - 4 * a * c > 0) { cout << 2 << endl; long double disc = sqrt(pow(b, 2) - (4 * a * c)); x = (double)(-b + disc) / (2 * a); y = (double)(-b - disc) / (2 * a); if (x < y) { printf("%3.10lf\n", x); printf("%3.10lf \n", y); } if (y < x) { printf("%3.10lf\n", y); printf("%3.10lf\n", x); } } } return 0; }
8
CPP
#include <bits/stdc++.h> int Delta(long a, long b, long c) { double delta; delta = (double)(b * b - 4 * a * c); if (delta > 0) return 2; else if (delta < 0) return 0; else return 1; } int main() { long a, b, c; double x1 = 0, x2 = 0, d, k, n = 0; scanf("%d%d%d", &a, &b, &c); d = (double)b * b - 4 * a * c; k = sqrt(d); x1 = (double)(-b - k) / (2 * a); x2 = (double)(-b + k) / (2 * a); if (Delta(a, b, c) == 2) { if (a != 0) { printf("%d\n", 2); if (x1 < x2) { printf("%.10f\n", (double)x1); printf("%.10f\n", (double)x2); } else { printf("%.10f\n", (double)x2); printf("%.10f\n", (double)x1); } } else if (a == 0) { printf("%d\n", 1); printf("%.10f\n", (double)-c / b); } } else if (Delta(a, b, c) == 1) { if (a != 0 && b != 0 && c != 0) { printf("%d\n", 1); printf("%.10f\n", (double)-b / (2 * a)); } else if (a == 0 && b == 0 && c == 0) printf("%d\n", -1); else if (a != 0 && b == 0 && c == 0) { printf("%d\n", 1); printf("%.10f\n", 0); } else printf("%d\n", 0); } else printf("%d\n", 0); return 0; }
8
CPP
a, b, c = map(int, input().split()) ch1, ch2, ch3 = (a == 0), (b == 0), (c == 0) if ch1 and ch2 and ch3: answer = -1 elif ch1 and ch2: answer = 0 elif (ch1 and ch3) or (ch2 and ch3): answer = 1 answers = [0] elif ch1: answer = 1 answers = [-c/b] elif ch2: if -c/a > 0: answer = 2 answers = [-(-c/a)**0.5, (-c/a)**0.5] else: answer = 0 elif ch3: answer = 2 answers = [-b/a, 0] else: D = b**2 - 4*a*c if D > 0: answer = 2 answers = [(-b+D**0.5)/(2*a), (-b-D**0.5)/(2*a)] elif D == 0: answer = 1 answers = [-b/(2*a)] else: answer = 0 print(answer) if answer > 0: for i in sorted(answers): print(i)
8
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { long long delta, a, b, c; cin >> a >> b >> c; delta = b * b - 4 * a * c; if ((a == 0) && (b == 0) && (c == 0)) { cout << -1 << endl; } else if ((a == 0) && (b == 0) && (c != 0)) { cout << 0 << endl; } else if ((a == 0) && (b != 0)) { cout << 1 << endl; cout << fixed << setprecision(10); cout << -c / (b * 1.0) << endl; } else if (delta > 0) { cout << 2 << endl; cout << fixed << setprecision(10); if (a > 0) { cout << (-b - sqrt(delta)) / (2 * a * 1.0) << endl; cout << (-b + sqrt(delta)) / (2 * a * 1.0) << endl; } else { cout << (-b + sqrt(delta)) / (2 * a * 1.0) << endl; cout << (-b - sqrt(delta)) / (2 * a * 1.0) << endl; } } else if (delta == 0) { cout << 1 << endl; cout << fixed << setprecision(10); cout << -b / (2 * a * 1.0) << endl; } else { cout << 0 << endl; } return 0; }
8
CPP
a,b,c = list(map(int, input().strip().split())) import sys if a == 0: if b == 0: if c == 0: print(-1) sys.exit(0) else: print(0) sys.exit(0) else: print(1) print(-c/b) sys.exit(0) else: a,b,c = 1, b/a, c/a if b == 0: if c == 0: print(1) print('{0:.10f}'.format(0)) sys.exit(0) if c < 0: print(2) print('{0:.10f}'.format(-c**0.5)) print('{0:.10f}'.format(c**0.5)) sys.exit(0) if c > 0: print(0) else: if c == 0: nicli = set([0]) nicli.add(-b) print(len(nicli)) for e in sorted(list(nicli)): print('{0:.10f}'.format(e)) sys.exit(0) else: d = b*b - 4*a*c if d < 0: print(0) sys.exit(0) elif abs(d) < 10**-12: print(1) print('{0:.10f}'.format(-b/(2*a))) sys.exit(0) else: x1 = max((-b + d**0.5) / (2*a),(-b - d**0.5) / (2*a)) x2 = c/x1 koreni = set() koreni.add(round(x1,10)) koreni.add(round(x2,10)) koreni = sorted(list(koreni)) print(len(koreni)) for e in koreni: print('{0:.10f}'.format(e)) sys.exit(0)
8
PYTHON3
from decimal import * a, b, c = map(int,input().split()) if a != 0: if b**2 - 4*a*c < 0: print(0) else: arr = [(-b + (b**2 - 4*a*c)**(0.5))/(2*a), (-b-(b**2 - 4*a*c)**(0.5))/(2*a)] if max(arr) == min(arr): print(1) print(float(Decimal(arr[0]))) else: print(len(arr)) print(float(Decimal(min(arr)))) print(float(Decimal(max(arr)))) elif a == 0 and b != 0: print(1) print(float(Decimal(-c/b))) elif a == b == c == 0: print(-1) else: print(0)
8
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k; double a, b, c, t, x1, x2; scanf("%lf%lf%lf", &a, &b, &c); t = b * b - a * c * 4; if (a == 0 && b == 0 && c == 0) { printf("-1\n"); return 0; } if (a == 0) { if (b == 0) { printf("0\n"); return 0; } else { b = c * (-1) / b; printf("1\n%.9lf\n", b); return 0; } } if (t < 0) { printf("0\n"); return 0; } if (t == 0) { printf("1\n"); x1 = b * (-1.0) / (a * 2.0); printf("%.9lf\n", x1); } else { printf("2\n"); x1 = (b * (-1.0) - sqrt(t)) / (a * 2.0); x2 = (b * (-1.0) + sqrt(t)) / (a * 2.0); t = min(x1, x2); x2 = max(x1, x2); x1 = t; printf("%.9lf\n%.9lf\n", x1, x2); } return 0; }
8
CPP
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c, d; cin >> a >> b >> c; if (!a && b) { cout << "1\n"; cout << fixed << setprecision(7) << (-c / b); return 0; } if (!a && !b && !c) { cout << "-1"; return 0; } d = b * b - 4 * a * c; if (d < 0 || (!a && !b && c)) { cout << "0"; return 0; } d = sqrt(d); if (a < 0) d = d * -1; if (!d) { cout << "1\n"; cout << fixed << setprecision(7) << ((-b - d) / (2 * a)); return 0; } else { cout << "2\n"; cout << fixed << setprecision(7) << ((-b - d) / (2 * a)) << "\n"; cout << fixed << setprecision(7) << ((-b + d) / (2 * a)) << "\n"; return 0; } }
8
CPP
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jun 16 03:38:40 2018 @author: anshul """ from math import sqrt a,b,c=list(map(int,input().split())) if a==0 and b==0 and c==0: print(-1) elif a==0 and b==0: print(0) elif a==0: print(1) ans=(-1*c)/b print(ans) else: d = b*b - 4*a*c if d<0: print(0) elif d>0: print(2) d=sqrt(d) ans1=(-b-d)/(2*a) ans2=(-b+d)/(2*a) if ans1<ans2: ans1,ans2=ans2,ans1 print(ans2) print(ans1) else: print(1) ans=(-b)/(2*a) print(ans)
8
PYTHON3
a,b,c=map(int,input().split()) d=b*b-4*a*c if a==0: if b==0 and c==0: print(-1) elif b==0: print(0) else: print(f'1\n{-c/b}') elif d<0: print(0) else: s=sorted({(-b+d**.5)/(2*a),(-b-d**.5)/(2*a)}) print(len(s)) for i in s: print(f'{i:.5f}')
8
PYTHON3
import math as m a,b,c=[int(s) for s in input().split()] if a==0: if b==0: if c==0: print(-1) else: print(0) else: print(1) print(-c/b) else: if a<0: a,b,c=-a,-b,-c d=b**2-4*a*c if d>0: print(2) print((-b-m.sqrt(d))/(2*a)) print((-b+m.sqrt(d))/(2*a)) elif d==0: print(1) print(-b/(2*a)) else: print(0)
8
PYTHON3
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c; while (cin >> a >> b >> c) { if (a == 0 && b == 0) { if (c == 0) cout << -1 << endl; else cout << 0 << endl; } else if (a == 0 && c == 0) cout << 1 << endl << 0 << endl; else if (b == 0 && c == 0) cout << 1 << endl << 0 << endl; else if (a == 0) printf("1\n%.6lf\n", -c * 1.0 / b); else { double tmp = b * b - 4 * a * c; if (tmp < 0) cout << 0 << endl; else if (tmp == 0) { cout << 1 << endl; printf("%.6lf\n", -b * 1.0 / (2 * a)); } else { cout << 2 << endl; double ans = sqrt(tmp); double x = (-b + ans) / (2 * a); double y = (-b - ans) / (2 * a); if (x > y) printf("%.6lf\n%.6lf\n", y, x); else printf("%.6lf\n%.6lf\n", x, y); } } } return 0; }
8
CPP
def shovel(a,b,c): if a==0 and b==0 and c==0: return -1 if a==0 and b==0: return 0 if a==0 : print(1) return '%.5f'%(-c/b) if b==0: if c==0: print(1) return '%.5f'%(0) x=b*b-4*a*c if x<0: return 0 if x==0: print(1) return '%.5f'%(-b/(2*a)) y=(-b - (x ** 0.5)) / (2 * a) z=(-b+(x**0.5))/(2*a) print(2) if y<z: print('%.5f'%(y)) return '%.5f'%(z) print('%.5f' % (z)) return '%.5f' % (y) a,b,c=map(int,input().split()) print(shovel(a,b,c))
8
PYTHON3
a, b, c = map(int, input().split()) d = b**2 - 4*a*c if a == b == 0 == c: print(-1) elif d < 0 or a == b == 0: print(0) elif d == 0: print(1) print( "{0:5f}".format(round(-b/(2*a), 5))) elif a == 0: print(1) x = round(-c/b, 5) print( "{0:5f}".format(x)) else: print(2) x = "{0:5f}".format(round((-b + d**0.5)/(2*a), 5)) y = "{0:5f}".format(round((-b - d**0.5)/(2*a), 5)) x, y = sorted([x, y]) if x != y: print(x, y, sep = "\n") else: print(x)
8
PYTHON3
a, b, c = list(map(int, input().split())) if a == 0 and b == 0 and c == 0: print(-1) elif (b*b)<4*a*c: print(0) elif a == 0: if b == 0: print(0) else: print(1) print("{0:.5f}".format(-(c/b))) else: d = ((b*b) - 4*a*c) x1 = (-b + (d**0.5))/(2*a) x2 = (-b - (d**0.5))/(2*a) if x1 == x2: print(1) print("{0:.5f}".format(x1)) else: print(2) print("{0:.5f}".format(min(x1, x2))) print("{0:.5f}".format(max(x1, x2)))
8
PYTHON3
from math import sqrt a, b, c = map(int, input().split()) det = b * b - 4 * a * c if a == 0: if b == 0 and c == 0: print(-1) elif b == 0: print(0) else: print(1) p = round(-c / b, 5) print(p) elif det < 0: print(0) elif det == 0: print(1) p = round(-b / (a * 2), 5) print(p) else: print(2) neu = - b + sqrt(det) p = round(neu / (2 * a), 5) neu = - b - sqrt(det) q = round(neu / (2 * a), 5) if p > q: p, q = q, p print(p) print(q) ''' And the shadow of the day Will embrace the word in grey And the sun will set for you '''
8
PYTHON3
#include <bits/stdc++.h> using namespace std; int a, b, c; int main() { while (cin >> a >> b >> c) { if (a == 0) { if (b == 0) { if (c == 0) puts("-1"); else puts("0"); } else { double ans = -(double)c / (double)b; printf("1\n%.5lf\n", ans); } } else { double det = (double)b * (double)b * 1.0 - 4.0 * (double)a * (double)c; if (det < 0) puts("0"); else if (det == 0) { double ans = -1.0 * b / (double)(2.0 * a); printf("1\n%.5lf\n", ans); } else { double x1, x2; x1 = -1.0 * b + sqrt(det); x2 = -1.0 * b - sqrt(det); x1 = x1 / (2.0 * a); x2 = x2 / (2.0 * a); if (x1 > x2) swap(x1, x2); printf("2\n%.5lf\n%.5lf\n", x1, x2); } } } return 0; }
8
CPP
a, b, c = [int(a) for a in input().split()] if a == 0: if b == 0: if c == 0: print(-1) else: print(0) else: print(1) print(-c / b) else: D = b ** 2 - 4 * a * c if D == 0: print(1) print(-b / (2 * a)) elif D < 0: print(0) else: print(2) ans = sorted([(-b - D ** 0.5) / (2 * a), (-b + D ** 0.5) / (2 * a)]) print(*ans, sep="\n")
8
PYTHON3