text
stringlengths
49
983k
#include <bits/stdc++.h> #define FOR(i,a,b) for(int i=(a);i<(ut)(b);i++) #define REP(i,b) FOR(i,0,b) #define ALL(c) c.begin(),c.end() #define PB push_back #define cat //cout << __LINE__ << endl; using namespace std; typedef long long LL; typedef double ld; typedef int ut; typedef vector<ut> VI; typedef pair<ut,ut> pr; typedef pair<ut,pr> ppr; typedef vector<pr> Vpr; typedef vector<ppr> Vppr; typedef priority_queue<pr,Vpr,greater<pr> > PQ; using namespace std; const int SIZE=1e6; const LL INF=1LL<<58; const LL p=1e9+7; vector<string> nums; int K; string s; double per; double solve(LL x,LL p){ if(x&1){return 1+solve(x-1,p)*per+solve(x+1,p)*(1-per);} double need=x/2; return need/per; } int main(){ LL x,p; cin >> x >> p; per=p/100.0; printf("%12.12f\n",solve(x,p)); return 0; }
#include "iostream" #include "iomanip" using namespace std; long double X; long double rad; long double ans; int main() { cin >> X >> rad; if ((long long int)X % 2 == 0) { for (int i = 0; i < 10000000; i++) { ans = (ans + X - rad / 100 * ans + (100.0 - rad) / 100 * ans) / 2; } } else { for (int i = 0; i < 10000000; i++) { ans = (ans+1 + X - rad / 100 * ans + (100.0 - rad) / 100 * ans) / 2; } } cout << setprecision(15) << ans; return 0; }
#include <iostream> #include <iomanip> #include <cstdio> #include <string> #include <cstring> #include <deque> #include <list> #include <queue> #include <stack> #include <vector> #include <utility> #include <algorithm> #include <map> #include <set> #include <complex> #include <cmath> #include <limits> #include <climits> #include <ctime> #include <cassert> using namespace std; #define rep(i,a,n) for(int i=a; i<n; i++) #define repq(i,a,n) for(int i=a; i<=n; i++) #define repr(i,a,n) for(int i=a; i>=n; i--) #define pb(a) push_back(a) #define fr first #define sc second #define INF 2000000000 #define int long long int #define X real() #define Y imag() #define EPS (1e-10) #define EQ(a,b) (abs((a) - (b)) < EPS) #define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) ) #define LE(n, m) ((n) < (m) + EPS) #define LEQ(n, m) ((n) <= (m) + EPS) #define GE(n, m) ((n) + EPS > (m)) #define GEQ(n, m) ((n) + EPS >= (m)) typedef vector<int> VI; typedef vector<VI> MAT; typedef pair<int, int> pii; typedef long long ll; typedef complex<double> P; typedef pair<P, P> L; typedef pair<P, double> C; int dy[]={0, 0, 1, -1}; int dx[]={1, -1, 0, 0}; int const MOD = 1000000007; namespace std { bool operator<(const P& a, const P& b) { return a.X != b.X ? a.X < b.X : a.Y < b.Y; } } signed main() { int x, p; cin >> x >> p; cout << fixed << setprecision(10) << ((x - 1) / 2 + 1) / (double)p * 100.0 << endl; return 0; }
#include <bits/stdc++.h> #define ADD(a, b) a = (a + ll(b)) % mod #define MUL(a, b) a = (a * ll(b)) % mod #define MAX(a, b) a = max(a, b) #define MIN(a, b) a = min(a, b) #define rep(i, a, b) for(int i = int(a); i < int(b); i++) #define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--) #define all(a) (a).begin(), (a).end() #define sz(v) (int)(v).size() #define pb push_back #define sec second #define fst first #define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef pair<int, pi> ppi; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vl> mat; typedef complex<double> comp; void Debug() {cout << '\n'; } template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){ cout<<arg<<" ";Debug(rest...);} template<class T>ostream& operator<<(ostream& out,const vector<T>& v) { out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;} template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){ out<<"("<<v.first<<", "<<v.second<<")";return out;} const int MAX_N = 200010; const int MAX_V = 100010; const double eps = 1e-6; const ll mod = 1000000007; const int inf = 1 << 29; const ll linf = 1LL << 60; const double PI = 3.14159265358979323846; /////////////////////////////////////////////////////////////////////////////////////////////////// int N, P; void solve() { cin >> N >> P; if(N % 2 == 0) { cout << (N / 2) * (100.0 / P); } else { cout << (N - 1) / 2 + (100.0 - P) / P * (N + 1) / 2 + 1.0; } } int main() { #ifndef LOCAL ios::sync_with_stdio(false); cin.tie(0); #endif cout << fixed; cout.precision(20); srand((unsigned int)time(NULL)); #ifdef LOCAL //freopen("in.txt", "wt", stdout); //for tester freopen("in.txt", "rt", stdin); #endif solve(); #ifdef LOCAL cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"; #endif return 0; }
#include <bits/stdc++.h> #define _overload(_1,_2,_3,name,...) name #define _rep(i,n) _range(i,0,n) #define _range(i,a,b) for(int i=int(a);i<int(b);++i) #define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__) #define _rrep(i,n) _rrange(i,n,0) #define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i) #define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__) #define _all(arg) begin(arg),end(arg) #define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg)) #define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary) #define clr(a,b) memset((a),(b),sizeof(a)) #define bit(n) (1LL<<(n)) #define popcount(n) (__builtin_popcountll(n)) using namespace std; template<class T>bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0;} template<class T>bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0;} using ll = long long; using R = long double; const R EPS = 1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7 inline int sgn(const R& r) {return (r > EPS) - (r < -EPS);} inline R sq(R x) {return sqrt(max(x, 0.0L));} const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; // Problem Specific Parameter: int main(void) { ll x, t; cin >> x >> t; const R p = 1.0 * t / 100.0; const R q = 1.0 - p; R ans = 1.0 * (x / 2) / p; if (x % 2 == 1) ans += q / p + 1.0; cout.precision(20); cout << fixed << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) //const ll mod = 1000000007; long double f(int x, long double p) { if(x % 2 == 1){ return p * f(x - 1, p) + (1 - p) * f(x + 1, p) + 1; } return (x / 2) * (1 / p); } int main() { cout.precision(10); int x; long double p; cin >> x >> p; p = p / 100; cout << f(x, p) << endl; return 0; }
/** * author: tourist * created: 26.11.2019 09:30:33 **/ #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int x; cin >> x; double p; cin >> p; p *= 0.01; if (x % 2 == 1) { cout << fixed << setprecision(17) << (x + 1) / 2 / p << '\n'; } else { cout << fixed << setprecision(17) << x / 2 / p << '\n'; } return 0; }
#include <cstdio> int main() { long long x; int p; scanf("%lld%d",&x,&p); printf("%lf\n",(x+1)/2*(double)100./p); return 0; }
#include<iostream> #include<string> #include<cstdio> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<ciso646> #include<random> #include<map> #include<set> #include<complex> #include<bitset> using namespace std; typedef long long ll; typedef unsigned int ui; const ll MOD = 998244353; const ll INF = (ll)1000000007 * 1000000007; typedef pair<int, int> P; #define stop char nyaa;cin>>nyaa; #define rep(i,n) for(int i=0;i<n;i++) #define per(i,n) for(int i=n-1;i>=0;i--) #define Rep(i,sta,n) for(int i=sta;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) #define per1(i,n) for(int i=n;i>=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) typedef long double ld; typedef complex<ld> Point; const ld eps = 1e-11; const ld pi = acos(-1.0); typedef pair<ll, ll> LP; typedef pair<ld, ld> LDP; int main() { ll x; int p; cin >> x >> p; cout << fixed << setprecision(7); if (x % 2) { cout << (ld)50 * (x + 1) / p << endl; } else { cout << (ld)50 * x / p << endl; } return 0; }
#include<iostream> #include<fstream> #include<algorithm> #include<vector> #include<queue> #include<map> #include<set> #include<string> #include<cmath> using namespace std; #define REP(i,m,n) for(int i=(m); i<(int)(n); i++) #define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--) #define rep(i,n) REP(i,0,n) #define rrep(i,n) RREP(i,0,n) #define fi first #define se second #ifdef _DEBUG ifstream ifs("input"); #define input ifs #else #define input cin #endif #define DEBUG(x) cout<<#x<<": "<<x<<endl using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; const double PI = (1*acos(0.0)); const double INF = 1e9; const double EPS = 1e-9; const double mod = 1e9 + 7; int main(){ int x,p; input >> x >> p; printf("%.7lf", ceil(x/2.0) * (100.0/p)); return 0; }
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0;i<(int)(n);i++) #define ALL(x) (x).begin(), (x).end() typedef long long ll; typedef long double ld; const int INF = 1e9; const ld EPS = 1e-8; int main(){ int x, p; cin >> x >> p; long double res = ((x + 1) / 2) / (p / 100.0); cout << fixed << setprecision(10) << res << endl; return 0; }
#include<bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false), cin.tie(0); int x, pp; cin >> x >> pp; double p = pp / 100.0; double ans; if(x % 2) { ans = 1 + (1 / p) * (x / 2) + (1 / p) * (1 - p); } else { ans = (1 / p) * (x / 2); } cout << fixed << setprecision(7) << ans << endl; }
#include <algorithm> #include <cassert> #include <cctype> #include <cstdlib> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #include <utility> #define reps(i,f,n) for(int i=f; i<int(n); ++i) #define rep(i,n) reps(i,0,n) using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pii; const int INF = 1001001001; signed main() { int x, p; cin >> x >> p; cout << setprecision(15) << (x+1)/2 * 100.0 / p << endl; }
#include <bits/stdc++.h> using namespace std; #define DEBUG_MODE #define endl '\n' #ifdef DEBUG_MODE #define DEBUG(...) debug_func_mult(split_names(#__VA_ARGS__), __VA_ARGS__) #define DEBUG_ENDL endl << flush #define DEBUG_SEPARATOR_LINE cout<<"=================\n" #else #define DEBUG(...) 0 #define DEBUG_ENDL 0 #define DEBUG_SEPARATOR_LINE 0 #endif #define ALL(V) (V).begin(), (V).end() #define ALLR(V) (V).rbegin(), (V).rend() #define DEBUG_ENDL_S(S) ((S).size() ? "\n" : "") << flush; template <typename T> using V = vector<T>; template <typename T> using VV = V<V<T>>; template <typename T, typename U> using P = pair<T, U>; using ll = int64_t; using PLL = P<ll, ll>; template <typename T> const T& var_min(const T &t) { return t; } template <typename T> const T& var_max(const T &t) { return t; } template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); } template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); } template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); } template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); } string to_string(const string &s) { return s; } template <typename T, typename U> string to_string(const P<T, U> &p) { string ret = "("; ret += to_string(p.first); ret += ", "; ret += to_string(p.second); ret += ")"; return move(ret); } template <typename T> string to_string(const V<T> &v) { string ret = "{"; for(const T &t : v) { ret += to_string(t); ret += ", "; } ret += "}"; return move(ret); } template <typename T> void debug_func(const T &t, const string &s = "") { if(s.size()) cout << s << " = "; cout << to_string(t) << DEBUG_ENDL_S(s); } template <typename T> void debug_func_mult(int idx, const V<string> &names, const T &t) { debug_func(t, names[idx]); } template <typename T> void debug_func_mult(const V<string> &names, const T &t) { debug_func(t, names[0]); } template <typename Head, typename... Tail> void debug_func_mult(int idx, const V<string> &names, const Head &head, const Tail&... args) { debug_func(head, names[idx]); debug_func_mult(idx + 1, names, args...); } template <typename Head, typename... Tail> void debug_func_mult(const V<string> &names, const Head &head, const Tail&... args) { debug_func(head, names[0]); debug_func_mult(1, names, args...); } V<string> split_names(string &&s) { replace(ALL(s), ' ', ','); V<string> ret; istringstream ss(s); string t; while(getline(ss, t, ',')) if(t.size()) ret.push_back(move(t)); return move(ret); } void init_io() { cin.tie(0); ios_base::sync_with_stdio(false); cout << fixed << setprecision(30); } double calc(double P, ll cnt) { if(cnt == 0) return 0; return (cnt / 2) / P; } int main() { init_io(); ll X; double P; cin >> X >> P; P /= 100; if(X & 1) cout << P * (calc(P, X - 1) + 1) + (1 - P) * (calc(P, X + 1) + 1); else cout << calc(P, X); cout << endl; return 0; }
#pragma region include #include <iostream> #include <iomanip> #include <stdio.h> #include <sstream> #include <algorithm> #include <iterator> #include <cmath> #include <complex> #include <string> #include <cstring> #include <vector> #include <tuple> #include <bitset> #include <queue> #include <complex> #include <set> #include <map> #include <stack> #include <list> #include <fstream> #include <random> //#include <time.h> #include <ctime> #pragma endregion //#include ///////// #define REP(i, x, n) for(int i = x; i < n; ++i) #define rep(i,n) REP(i,0,n) #define ALL(X) X.begin(), X.end() ///////// #pragma region typedef typedef long long LL; typedef long double LD; typedef unsigned long long ULL; typedef std::pair<LL,LL> PLL;// typedef std::pair<int,int> PII;// #pragma endregion //typedef ////定数 const int INF = (int)1e9; const LL MOD = (LL)1e9+7; const LL LINF = (LL)1e18+20; const LD PI = acos(-1.0); const double EPS = 1e-9; ///////// using namespace::std; void solve(){ int X; double P; cin >> X >> P; if( P == 100 ){ double ans = (X+1)/2; cout << ans << endl; return; } if( X <= 10 ){ double p = P/100; double q = 1-p; if( X%2 == 0 ){//Xが偶数 vector<double> dp(X+10,0); dp[0] = 0.0;//距離が0の時の期待値 int now = 0; for(;now<X;now += 2 ){ dp[now+2] = dp[now] + 1.0/p; } double ans = dp[X]; cout << ans << endl; return; }else{//距離Xが奇数 vector<double> dp(X+20,0); dp[0] = 0.0; int now = 0; for(;now<X+4; now += 2 ){ dp[now+2] = dp[now] + 1.0/p; } double ans = dp[X-1]*p + dp[X+1]*q + 1.0;///// cout << ans << endl; return; } return; } if( X&1 ){//奇数 double p = P/100; double q = 1-p; double cnt1 = (X-1)/2; double cnt2 = (X+1)/2; double res1 = (1.0/p) * cnt1; double res2 = (1.0/p) * cnt2; double ans = res1 * p + res2 * q + 1.0; cout << ans << endl; }else{//偶数 double p = P/100; double q = 1-p; double cnt = X/2;//cnt回pを引き当てる。 //pを1回引くまでの、試行回数の期待値は1/p double ans = (1.0/p) * cnt; cout << ans << endl; } } #pragma region main signed main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;//小数を10進数表示 cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別 solve(); } #pragma endregion //main()
#include <bits/stdc++.h> using namespace std; double f(int p, int n) { double P = p/100.0; double Q = 1.0 - P; double ans = (-n)/(2*(Q-1)); return ans; } int main() { int x,p; cin>>x>>p; cout.precision(10); double ans; if(x%2) ans = 1.0 + (p/100.0)*f(p,x-1) + ((100 - p)/100.0)*f(p,x+1); else ans = f(p,x); cout<<fixed<<ans<<"\n"; return 0; }
#ifndef KOMAKI_LOCAL #define NDEBUG #endif #include <bits/stdc++.h> #include <sys/time.h> #include <unistd.h> using namespace std; #define i64 int64_t #define rep(i, n) for(i64 i = 0; i < ((i64)(n)); ++i) #define sz(v) ((i64)((v).size())) #define bit(n) (((i64)1)<<((i64)(n))) #define all(v) (v).begin(), (v).end() std::string dbgDelim(int &i){ return (i++ == 0 ? "" : ", "); } #define dbgEmbrace(exp) { int i = 0; os << "{"; { exp; } os << "}"; return os; } template <class T> std::ostream& operator<<(std::ostream &os, std::vector<T> v); template <class T> std::ostream& operator<<(std::ostream &os, std::set<T> v); template <class T> std::ostream& operator<<(std::ostream &os, std::queue<T> q); template <class T> std::ostream& operator<<(std::ostream &os, std::priority_queue<T> q); template <class T, class K> std::ostream& operator<<(std::ostream &os, std::pair<T, K> p); template <class T, class K> std::ostream& operator<<(std::ostream &os, std::map<T, K> mp); template <class T, class K> std::ostream& operator<<(std::ostream &os, std::unordered_map<T, K> mp); template <int INDEX, class TUPLE> void dbgDeploy(std::ostream &os, TUPLE tuple){} template <int INDEX, class TUPLE, class H, class ...Ts> void dbgDeploy(std::ostream &os, TUPLE t) { os << (INDEX == 0 ? "" : ", ") << get<INDEX>(t); dbgDeploy<INDEX + 1, TUPLE, Ts...>(os, t); } template <class T, class K> void dbgDeploy(std::ostream &os, std::pair<T, K> p, std::string delim) { os << "(" << p.first << delim << p.second << ")"; } template <class ...Ts> std::ostream& operator<<(std::ostream &os, std::tuple<Ts...> t) { os << "("; dbgDeploy<0, std::tuple<Ts...>, Ts...>(os, t); os << ")"; return os; } template <class T, class K> std::ostream& operator<<(std::ostream &os, std::pair<T, K> p) { dbgDeploy(os, p, ", "); return os; } template <class T> std::ostream& operator<<(std::ostream &os, std::vector<T> v) { dbgEmbrace( for(T t: v){ os << dbgDelim(i) << t; }); } template <class T> std::ostream& operator<<(std::ostream &os, std::set<T> s) { dbgEmbrace( for(T t: s){ os << dbgDelim(i) << t; }); } template <class T> std::ostream& operator<<(std::ostream &os, std::queue<T> q) { dbgEmbrace( for(; q.size(); q.pop()){ os << dbgDelim(i) << q.front(); }); } template <class T> std::ostream& operator<<(std::ostream &os, std::priority_queue<T> q) { dbgEmbrace( for(; q.size(); q.pop()){ os << dbgDelim(i) << q.top(); }); } template <class T, class K> std::ostream& operator<<(std::ostream &os, std::map<T, K> mp) { dbgEmbrace( for(auto p: mp){ os << dbgDelim(i); dbgDeploy(os, p, "->"); }); } template <class T, class K> std::ostream& operator<<(std::ostream &os, std::unordered_map<T, K> mp) { dbgEmbrace( for(auto p: mp){ os << dbgDelim(i); dbgDeploy(os, p, "->"); }); } #define DBG_OUT std::cerr #define DBG_OVERLOAD(_1, _2, _3, _4, _5, _6, macro_name, ...) macro_name #define DBG_LINE() { char s[99]; sprintf(s, "line:%3d | ", __LINE__); DBG_OUT << s; } #define DBG_OUTPUT(v) { DBG_OUT << (#v) << "=" << (v); } #define DBG1(v, ...) { DBG_OUTPUT(v); } #define DBG2(v, ...) { DBG_OUTPUT(v); DBG_OUT << ", "; DBG1(__VA_ARGS__); } #define DBG3(v, ...) { DBG_OUTPUT(v); DBG_OUT << ", "; DBG2(__VA_ARGS__); } #define DBG4(v, ...) { DBG_OUTPUT(v); DBG_OUT << ", "; DBG3(__VA_ARGS__); } #define DBG5(v, ...) { DBG_OUTPUT(v); DBG_OUT << ", "; DBG4(__VA_ARGS__); } #define DBG6(v, ...) { DBG_OUTPUT(v); DBG_OUT << ", "; DBG5(__VA_ARGS__); } #define DEBUG0() { DBG_LINE(); DBG_OUT << std::endl; } #define DEBUG(...) \ { \ DBG_LINE(); \ DBG_OVERLOAD(__VA_ARGS__, DBG6, DBG5, DBG4, DBG3, DBG2, DBG1)(__VA_ARGS__); \ DBG_OUT << std::endl; \ } int main() { i64 x; double p; cin >> x >> p; p /= 100; printf("%0.20lf\n", (x + 1) / 2 * (1.0 / p)); }
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <vector> #include <string> #include <deque> #include <map> #include <set> #include <cassert> using namespace std; #define rep(i,a,n) for (int i=a;i<n;i++) #define per(i,a,n) for (int i=n-1;i>=a;i--) #define pb push_back #define mp make_pair #define fi first #define se second #define sz(x) ((int)(x).size()) #define It iterator typedef vector<int> VI; typedef long long ll; typedef pair<int,int> PII; int main() { //freopen("test.in","r",stdin); ll x,p; cin>>x>>p; double xx=x/2+x%2; printf("%.6f",xx/p*100); return 0; }
#include <stdio.h> #include <algorithm> #include <assert.h> #include <bitset> #include <cmath> #include <complex> #include <deque> #include <functional> #include <iostream> #include <limits.h> #include <map> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string.h> #include <string> #include <time.h> #include <unordered_map> #include <unordered_set> #include <vector> #define ll long long #define rep2(i,a,b) for(ll i=a;i<=b;++i) #define rep(i,n) for(ll i=0;i<n;i++) #define rep3(i,a,b) for(ll i=a;i>=b;i--) #define REP(e,v) for(auto e:v) #define pii pair<int,int> #define pll pair<ll,ll> #define tii tuple<int,int,int> #define pq priority_queue<int> #define pqg priority_queue<int,vector<int>,greater<int>> #define pb push_back #define edge(v,a,b) v[a].pb(b);v[b].pb(a); #define MAX_V 400010 #define vec vector<int> #define vecll vector<ll> #define vecpii vector<pii> #define endl "\n" #define ALL(c) (c).begin(),(c).end() using namespace std; int in() {int x;scanf("%d",&x);return x;} ll lin() {ll x;scanf("%lld",&x);return x;} #define INF 1e9+7 #define LLINF 1e18+7 ll MOD=1e9+7; #define N 1055050 int main(){ ll x=in(); double p=in(); ll ans=0; if(x%2)x++; double xx=x; xx/=2.0; printf("%.10f\n",xx/p*100.0); }
#include <bits/stdc++.h> using namespace std; double x, p; int main() { cin >> x >> p; double res = floor((x + 1) / 2) / (p / 100); printf("%.8f", res); }
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> P; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; // #define int long long #define pb push_back #define mp make_pair #define eps 1e-9 #define INF 2000000000 #define LLINF 10000000000000ll #define fi first #define sec second #define all(x) (x).begin(),(x).end() #define sq(x) ((x)*(x)) #define dmp(x) cerr << #x << ": " << x << endl; template<class T> void chmin(T& a,const T& b){if(a>b)a=b;} template<class T> void chmax(T& a,const T& b){if(a<b)a=b;} template<class T> using MaxHeap = priority_queue<T>; template<class T> using MinHeap = priority_queue<T,vector<T>,greater<T> >; template<class T,class U> ostream& operator << (ostream& os,const pair<T,U>& p){ os << p.fi << ',' << p.sec; return os; } template<class T,class U> istream& operator >> (istream& is,pair<T,U>& p){ is >> p.fi >> p.sec; return is; } template<class T> ostream& operator << (ostream &os,const vector<T> &vec){ for(int i=0;i<vec.size();i++){ os << vec[i]; if(i+1<vec.size())os << ' '; } return os; } template<class T> istream& operator >> (istream &is,vector<T>& vec){ for(int i=0;i<vec.size();i++)is >> vec[i]; return is; } void fastio(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); } namespace Math{ template<int MOD> // if inv is needed, this shold be prime. struct ModInt{ ll val; ModInt():val(0ll){} ModInt(const ll& v):val(((v%MOD)+MOD)%MOD){} ModInt pow(ModInt a,ll x){ ModInt res = ModInt(1ll); while(x){ if(x&1)res *= a; x >>= 1; a = a*a; } return res; } bool operator==(const ModInt& x)const{return val==x.val;} bool operator!=(const ModInt& x)const{return !(*this==x);} bool operator<(const ModInt& x)const{return val<x.val;} bool operator>(const ModInt& x)const{return val>x.val;} bool operator>=(const ModInt& x)const{return !(*this<x);} bool operator<=(const ModInt& x)const{return !(*this>x);} ModInt& operator+=(const ModInt& x){if((val+=x.val)>=MOD)val-=MOD;return *this;} ModInt& operator-=(const ModInt& x){if((val+=MOD-x.val)>=MOD)val-=MOD;return *this;} ModInt& operator*=(const ModInt& x){(val*=x.val)%=MOD;return *this;} ModInt operator+(const ModInt& x)const{return ModInt(*this)+=x;} ModInt operator-(const ModInt& x)const{return ModInt(*this)-=x;} ModInt operator*(const ModInt& x)const{return ModInt(*this)*=x;} friend istream& operator>>(istream&i,ModInt& x){ll v;i>>v;x=v;return i;} friend ostream& operator<<(ostream&o,const ModInt& x){o<<x.val;return o;} }; constexpr int MOD = 1e9+7; using mint = ModInt<MOD>; vector<mint> inv,fac,facinv; // notice: 0C0 = 1 ModInt<MOD> nCr(int n,int r){ assert(!(n<r)); assert(!(n<0||r<0)); return fac[n]*facinv[r]*facinv[n-r]; } void init(int SIZE){ fac.resize(SIZE+1); inv.resize(SIZE+1); facinv.resize(SIZE+1); fac[0] = inv[1] = facinv[0] = mint(1ll); for(int i=1;i<=SIZE;i++)fac[i]=fac[i-1]*mint(i); for(int i=2;i<=SIZE;i++)inv[i]=mint(0ll)-mint(MOD/i)*inv[MOD%i]; for(int i=1;i<=SIZE;i++)facinv[i]=facinv[i-1]*inv[i]; return; } } namespace DS{ template<class T> struct RangeSum{ vector<T> vec; RangeSum(){} RangeSum(vector<T> elems):vec(elems){ for(int i=1;i<vec.size();i++){ vec[i] += vec[i-1]; } } T sum(int l,int r){ if(l>r)return T(0); if(l==0)return vec[r]; else return vec[r]-vec[l-1]; } }; template<class T,int N> struct BIT{ vector<T> bit; BIT(){ bit = vector<T>(N+1,T(0)); } void add(int i,T x){ i++; while(i<=N){ bit[i]+=x; i+=i&-i; } return; } T sum(int i){ i++; T res = T(0); while(i>0){ res+=bit[i]; i-=i&-i; } return res; } T sum(int l,int r){// [l,r] assert(l<=r); if(l==0)return sum(r); else return sum(r)-sum(l-1); } }; } signed main(){ fastio(); int x,p; cin >> x >> p; if(x&1)x++; cout << x/2.0*100.0/(double)p << endl; return 0; }
#include <iostream> #include <iomanip> using namespace std; double p; int x; int main(){ cin >> x >> p; p /= 100; if(x%2==1) x++; cout << setprecision(8) << x/(2*p) << endl; }
#include <bits/stdc++.h> typedef long long i64; using std::cout; using std::endl; using std::cin; int main() { int x, p; cin >> x >> p; cout << std::fixed << std::setprecision(10); cout << (double)((x + 1) / 2) / (p / 100.) << endl; return 0; }
#include <iostream> #include <iomanip> // << fixed << setprecision(xxx) #include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ; #include <vector> #include <string> // to_string(nnn) // substr(m, n) // stoi(nnn) #include <complex> #include <tuple> // get<n>(xxx) #include <queue> #include <stack> #include <map> // if (M.find(key) != M.end()) { } #include <set> // S.insert(M); // if (S.find(key) != S.end()) { } // for (auto it=S.begin(); it != S.end(); it++) { } // auto it = S.lower_bound(M); #include <cctype> #include <cassert> #include <cmath> #include <cstdio> #include <cstdlib> // atoi(xxx) using namespace std; typedef long long ll; //const int dx[4] = {1, 0, -1, 0}; //const int dy[4] = {0, 1, 0, -1}; // const int C ; // const int M = 1000000007; int main () { ll x; int p; cin >> x >> p; if (x%2 == 1) { x++; } double pp = p/(double)100; double vec = -1 * pp + (1-pp); vec -= 1; cout << fixed << setprecision(12) << x/(-1 * vec) << endl; }
#include <bits/stdc++.h> using namespace std; typedef long long LL; int main(){ LL x, p1; cin >> x >> p1; double p = ((double)p1) / 100.0; if(x % 2) x++; x /= 2; double r = ((double)x)/p; printf("%.9lf\n", r); }
#include<iostream> #include<cstdio> #include<algorithm> #include<set> #include<map> #include<queue> #include<cassert> #include<iomanip> #define PB push_back #define MP make_pair #define sz(v) (in((v).size())) #define forn(i,n) for(in i=0;i<(n);++i) #define forv(i,v) forn(i,sz(v)) #define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i) #define all(v) (v).begin(),(v).end() using namespace std; typedef long long in; typedef vector<in> VI; typedef vector<VI> VVI; double t(in x, double p){ in tt=x/2; double tpt=1/p; return tt*tpt; } int main(){ ios::sync_with_stdio(0); cin.tie(0); in x; double p; cin>>x>>p; p/=100; cout<<setprecision(15); if(x%2!=0) cout<<1+p*t(x-1,p)+(1-p)*t(x+1,p)<<endl; else cout<<t(x,p)<<endl; return 0; }
#include <cstdio> #include <iostream> #include <string> #include <vector> #include <sstream> #include <map> #include <set> #include <queue> #include <algorithm> #include <cmath> #include <cstring> #include <typeinfo> #include <numeric> #include <functional> #include <unordered_map> #include <bitset> #include <stack> #include <assert.h> #include <unordered_set> using namespace std; using ll = long long; using ull = unsigned long long; const ll INF = 1e16; const ll MOD = 1e9 + 7; #define REP(i, n) for(ll i = 0; i < n; i++) int main(){ int x; double p; cin >> x >> p; p /= 100.0; double xx = (x + 1) / 2; printf("%.11lf\n", xx / p); }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) (x).begin(),(x).end() const int mod=1000000007,MAX=4003,INF=1<<30; int main(){ long double X,P;cin>>X>>P; if(int(X)%2==0){ cout<<setprecision(25)<<100.0/P*(X/2.0)<<endl; }else{ cout<<setprecision(25)<<(P/100.0)*(100.0/P)*((X-1.0)/2.0)+((100.0-P)/100.0)*(100.0/P)*((X+1.0)/2.0)+1.0<<endl; } }
#include <cstdio> int x, p; int main() { scanf("%d %d", &x, &p); printf("%.12lf\n", 50.0 * (x + x % 2) / p); return 0; }
#include <iostream> #include <iomanip> using namespace std; int main(){ int x, p; cin >> x >> p; double ans; if(x%2 == 0){ ans = ((double)(x/2))*((double)(100)/(double)(p)); }else{ ans = ((double)((x+1)/2))*((double)(100)/(double)(p)); } cout << fixed; cout << setprecision(9) << ans << endl; }
#include <iostream> #include <cstdio> #include <cmath> #include <ctime> #include <cstdlib> #include <cassert> #include <vector> #include <list> #include <stack> #include <queue> #include <deque> #include <map> #include <set> #include <bitset> #include <string> #include <algorithm> #include <utility> #define llint long long #define inf 1e18 #define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++) #define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++) #define chmin(x, y) (x) = min((x), (y)) #define chmax(x, y) (x) = max((x), (y)) #define mod 998244353 using namespace std; typedef pair<llint, llint> P; typedef pair<llint, P> E; llint x; double p; double calc(llint x) { return 1/p*x; } int main(void) { cin >> x; cin >> p; p /= 100; double ans; if(x % 2 == 0) ans = calc(x/2); else ans = 1 + p*calc((x-1)/2) + (1-p)*calc((x+1)/2); printf("%.11f\n", ans); return 0; }
#include<bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<vvd> vvvd; typedef pair<int, int> pii; typedef vector<pii> vpii; #define pb push_back #define mp make_pair #define snd second #define fst first #define debug printf("--%d--\n",__LINE__) #define ll long long int int x, p; int main(void){ cin >> x >> p; int n = (abs(x)+1)/2; int q = ((x>0) ? p : 100-p); double pr = 0.01 * q; printf("%.8f\n", n / pr); return 0; }
#include<bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<b;i++) double rec(int x, double p) { if (x % 2) return p * rec(x - 1, p) + (1 - p) * rec(x + 1, p) + 1; return x / p / 2; } //----------------------------------------------------------------- int main() { int x, p; cin >> x >> p; double ans = rec(x, p / 100.0); printf("%.10f\n", ans); }
#include <cstdio> #include <cstring> #include <string> #include <iostream> #include <cmath> #include <bitset> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> #include <unordered_map> using namespace std; typedef long long int ll; typedef pair<int, int> P; int main() { ll x; double p; cin>>x>>p; if(x%2) printf("%.7lf\n", ((double)x+1)/2/p*100); else printf("%.7lf\n", ((double)x)/2/p*100); return 0; }
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <iomanip> #include <stdio.h> #include <algorithm> #include <math.h> #include <numeric> #include <iterator> #include <fstream> #include <math.h> #include <random> #include <vector> #include <string> #include <stack> #include <set> #include <map> #include <deque> #include <queue> #include <list> #include <bitset> #include <unordered_set> #include <unordered_map> #include <random> #include <ctime> #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define FOR(i, from, to) for (int i = from; i < to; i++) #define ROF(i, from, to) for (int i = from; i > to; i--) const long double PI = 3.141592653589793238463; const int INF = 0x3f3f3f3f; const int INFS = 1000000000; const ll M = 1000000007; const ll LLINF = 1000000000000000000; const double EPS = 1e-8; #define int long long signed main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int x, p; cin >> x >> p; ld ans; int tmp = (x + 1) / 2; ans = (ld(100) / ld(p)) * ld(tmp); cout << fixed << setprecision(20) << ans << "\n"; return 0; }
#include <iostream> #include <stdio.h> using namespace std; int x; double p; int main(void) { cin >> x >> p; p /= 100; double ans; if(x % 2 == 0){ ans = x/2/p; } else{ ans = p*(x-1)/2/p + (1-p)*(x+1)/2/p + 1; } printf("%.11f\n", ans); return 0; }
#include<bits/stdc++.h> using namespace std; using Int = long long; struct Precision{ Precision(){ cout<<fixed<<setprecision(12); } }precision_beet; //INSERT ABOVE HERE signed main(){ int x; double p; cin>>x>>p; p/=100; double ans=(x&1); if(x&1){ ans+=p*(1/p)*(x-1)/2; ans+=(1.-p)*(1/p)*(x+1)/2; }else{ ans+=(1/p)*x/2; } cout<<ans<<endl; return 0; }
#include <vector> #include <iostream> #include <algorithm> #include <utility> #include <set> #include <map> #include <cmath> #include <iomanip> using namespace std; template<typename T, typename S> istream& operator >> (istream& is, pair<T, S>& p) { is >> p.first >> p.second; return is; } template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& x : v) { is >> x; } return is; } template<typename T> ostream& operator << (ostream& os, const vector<T>& v) { for (auto& x : v) { os << x << " "; } os << "\n"; return os; } long double ans(uint64_t x, long double p) { return (x / 2) / p; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); #ifdef _DEBUG freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif uint64_t x, P; cin >> x >> P; long double p = P / 100.0; cout << setprecision(9); if (x % 2 == 1) { cout << fixed << 1.0 + p * ans(x - 1, p) + (1.0 - p) * ans(x + 1, p); } else { cout << fixed << ans(x, p); } }
//xが偶数のとき, 移動方法が定まる(右に移動すればいい)ので簡単. //xが奇数のとき, 1ターン止まったあと, xが偶数のパターンになる。 //x-1, x+1どちらになっても(最適な)動き方は同じ・不完全情報ゲームより(?)、止まるタイミングは最初にして良いので簡単。 #include <iostream> #include <cstdio> using namespace std; int main() { int x, p; cin >> x >> p; double P = p * 0.01; if (x % 2 == 0) { printf("%.14f\n", x / (2 * P)); } else { double e1 = (x - 1) / (2 * P); double e2 = (x + 1) / (2 * P); printf("%.14f\n", P * e1 + (1 - P) * e2 + 1); } return 0; }
#include <bits/stdc++.h> #include <sys/time.h> using namespace std; #define rep(i,n) for(long long i = 0; i < (long long)(n); i++) #define repi(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++) #define pb push_back #define all(x) (x).begin(), (x).end() #define fi first #define se second #define mt make_tuple #define mp make_pair template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); } template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using P = pair<ll, ll>; ll ugauss(ll a, ll b) { if (!a) return 0; if (a>0^b>0) return a/b; else return (a+(a>0?-1:1))/b+1; } ll lgauss(ll a, ll b) { if (!a) return 0; if (a>0^b>0) return (a+(a>0?-1:1))/b-1; else return a/b; } template <typename T, typename U> ostream &operator<<(ostream &o, const pair<T, U> &v) { o << "(" << v.first << ", " << v.second << ")"; return o; } template<size_t...> struct seq{}; template<size_t N, size_t... Is> struct gen_seq : gen_seq<N-1, N-1, Is...>{}; template<size_t... Is> struct gen_seq<0, Is...> : seq<Is...>{}; template<class Ch, class Tr, class Tuple, size_t... Is> void print_tuple(basic_ostream<Ch,Tr>& os, Tuple const& t, seq<Is...>){ using s = int[]; (void)s{0, (void(os << (Is == 0? "" : ", ") << get<Is>(t)), 0)...}; } template<class Ch, class Tr, class... Args> auto operator<<(basic_ostream<Ch, Tr>& os, tuple<Args...> const& t) -> basic_ostream<Ch, Tr>& { os << "("; print_tuple(os, t, gen_seq<sizeof...(Args)>()); return os << ")"; } ostream &operator<<(ostream &o, const vvll &v) { rep(i, v.size()) { rep(j, v[i].size()) o << v[i][j] << " "; o << endl; } return o; } template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { o << '['; rep(i, v.size()) o << v[i] << (i != v.size()-1 ? ", " : ""); o << "]"; return o; } template <typename T> ostream &operator<<(ostream &o, const deque<T> &v) { o << '['; rep(i, v.size()) o << v[i] << (i != v.size()-1 ? ", " : ""); o << "]"; return o; } template <typename T> ostream &operator<<(ostream &o, const set<T> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]"; return o; } template <typename T> ostream &operator<<(ostream &o, const unordered_set<T> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]"; return o; } template <typename T, typename U> ostream &operator<<(ostream &o, const map<T, U> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]"; return o; } template <typename T, typename U, typename V> ostream &operator<<(ostream &o, const unordered_map<T, U, V> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it; o << "]"; return o; } vector<int> range(const int x, const int y) { vector<int> v(y - x + 1); iota(v.begin(), v.end(), x); return v; } template <typename T> istream& operator>>(istream& i, vector<T>& o) { rep(j, o.size()) i >> o[j]; return i;} template <typename T, typename S, typename U> ostream &operator<<(ostream &o, const priority_queue<T, S, U> &v) { auto tmp = v; while (tmp.size()) { auto x = tmp.top(); tmp.pop(); o << x << " ";} return o; } template <typename T> ostream &operator<<(ostream &o, const queue<T> &v) { auto tmp = v; while (tmp.size()) { auto x = tmp.front(); tmp.pop(); o << x << " ";} return o; } template <typename T> ostream &operator<<(ostream &o, const stack<T> &v) { auto tmp = v; while (tmp.size()) { auto x = tmp.top(); tmp.pop(); o << x << " ";} return o; } template <typename T> unordered_map<T, ll> counter(vector<T> vec){unordered_map<T, ll> ret; for (auto&& x : vec) ret[x]++; return ret;}; void vizGraph(vvll& g, int mode = 0, string filename = "out.png") { ofstream ofs("./out.dot"); ofs << "digraph graph_name {" << endl; set<P> memo; rep(i, g.size()) rep(j, g[i].size()) { if (mode && (memo.count(P(i, g[i][j])) || memo.count(P(g[i][j], i)))) continue; memo.insert(P(i, g[i][j])); ofs << " " << i << " -> " << g[i][j] << (mode ? " [arrowhead = none]" : "")<< endl; } ofs << "}" << endl; ofs.close(); system(((string)"dot -T png out.dot >" + filename).c_str()); } struct timeval start; double sec() { struct timeval tv; gettimeofday(&tv, NULL); return (tv.tv_sec - start.tv_sec) + (tv.tv_usec - start.tv_usec) * 1e-6; } size_t random_seed; struct init_{init_(){ ios::sync_with_stdio(false); cin.tie(0); gettimeofday(&start, NULL); struct timeval myTime; struct tm *time_st; gettimeofday(&myTime, NULL); time_st = localtime(&myTime.tv_sec); srand(myTime.tv_usec); random_seed = RAND_MAX / 2 + rand() / 2; }} init__; #define ldout fixed << setprecision(40) #define EPS (double)1e-14 #define INF (ll)1e18 #define mo (ll)(1e9+7) int main(void) { double x, p; cin >> x >> p; p /= 100; double ret = 0; if ((ll)(x) % 2 == 0) { ret = x / 2. / p; } else { ret = (x-1.)/2.+(1.-p)*(x+1.)/2./p+1; } cout << ldout << ret << endl; return 0; }
#include<iostream> #include<iomanip> using namespace std; int X; double p; double calc(int x) { return x/2/p; } int main() { cin>>X>>p;p/=100; double ans; if(X%2==0)ans=calc(X); else ans=p*calc(X-1)+(1-p)*calc(X+1)+1; cout<<fixed<<setprecision(16)<<ans<<endl; }
#include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <set> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <sstream> #include <complex> #include <stack> #include <queue> #include <cstdio> #include <cstring> #include <iterator> #include <bitset> #include <unordered_set> #include <unordered_map> #include <fstream> #include <iomanip> #include <cassert> #include <utility> #include <memory> #include <functional> #include <deque> #include <cctype> #include <ctime> #include <numeric> #include <list> #include <iomanip> #if __cplusplus >= 201103L #include <array> #include <tuple> #include <initializer_list> #include <forward_list> #define cauto const auto& #else #endif using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> vint; typedef vector<vector<int> > vvint; typedef vector<long long> vll; typedef vector<vector<long long> > vvll; #define VV(T) vector<vector< T > > template <class T> void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){ v.assign(a, vector<T>(b, t)); } template <class F, class T> void convert(const F &f, T &t){ stringstream ss; ss << f; ss >> t; } #define GET_MACRO(_1, _2, _3, NAME, ...) NAME #define _rep(i,n) _rep2((i),0,(n)) #define _rep2(i,a,b) for(int i=(a);i<(b);++i) #define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__) #define ALL(v) (v).begin(),(v).end() #define PB push_back #define fi first #define se second #define mkp make_pair #define DEBUG #ifdef DEBUG #define dump(x) cout << #x << " = " << (x) << endl; #define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; #else #define dump(x) #define debug(x) #endif #define MOD 1000000007LL #define EPS 1e-8 #define INF 0x3f3f3f3f #define INFL 0x3f3f3f3f3f3f3f3fLL #define maxs(x,y) x=max(x,y) #define mins(x,y) x=min(x,y) void mainmain(){ ll _x; cin>>_x; double x=_x; double p; cin>>p; p = p/100; double ans; if(_x%2==0){ ans = 1/p*x/2; } else{ ans = p*(1/p*(x-1)/2) + (1-p)*(1/p*(x+1)/2); ans+=1; } cout<<ans<<endl; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout<<fixed<<setprecision(20); mainmain(); }
#include <bits/stdc++.h> #include <assert.h> using namespace std; typedef long long ll; typedef long double ld; #define PB push_back #define MP make_pair #define MOD 1000000007LL #define endl "\n" const ll UNDEF = -1; const ll INF=1e18; template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; } template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; } typedef pair<ll,ll> pll; #ifdef DEBUG #define debug(args...) {dbg,args; cerr<<endl;} #else #define debug(args...) // Just strip off all debug tokens #endif struct debugger { template<typename T> debugger& operator , (const T& v) { cerr<<v<<" "; return *this; } } dbg; ld solve(ll b, ld p) { ld ans; if (b==0) ans=0; else ans=b/p; return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout<<fixed<<setprecision(10); ll x,pp; cin>>x>>pp; ld p=(ld)pp/100.0; ll b=x/2; if (x&1) { ld ans=solve(1,p)+(solve(b,p)); cout<<ans<<endl; } else { cout<<solve(b,p)<<endl; } }
#include <bits/stdc++.h> using namespace std; int main(){ long long X, P; cin >> X >> P; double ans; if(X % 2 == 0) ans = 50.0 * X / P; else ans = 50.0 * (X + 1.0) / P; cout.precision(15); cout << ans << endl; }
#include<map> #include<set> #include<bitset> #include<cstdio> #include<iostream> #include<algorithm> #include<vector> #include<queue> #include<string> #include<chrono> #include<stack> #include<fstream> #include<list> #define REP(i,x,y) for(ll i=x;i<=y;i++) #define SIZE(a) ll(a.size()) #define vll vector<ll> #define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m #define BIT(n) (ll(1)<<n) #define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) #define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1 #define SORT(a,n) sort(a+1,a+n+1) #define SORT_O(a,n,order) sort(a+1,a+n+1,order) #define PER(i,y,x) for(ll i=y;i>=x;i--) typedef long long ll; using namespace std; /* struct point { long long dist; long long name; bool operator<(const point& rhs) const { return dist > rhs.dist; } }; */ double f(ll x, double p) { return double(x) / p; } int main() { cout.precision(13); ll x; double p; cin >> x >> p; p /= 100; if (x % 2 == 0) { x /= 2; cout << f(x, p) << endl; } else { ll y = x / 2; x = y + 1; cout << 1+ (f(x, p)* (1-p) + f(y, p)*p) << endl; } }
#include<iostream> #include<string> #include<queue> #include<algorithm> #include<map> #include<set> #include<vector> #include<math.h> #include<time.h> using namespace std; #define INF 1000000007 #define LINF (1LL << 62) typedef long long i64; typedef pair<i64,i64> P; i64 n, m; int main(){ cin >> n >> m; printf("%.10f\n", (n+n%2)*50.0/m); return 0; }
#include<bits/stdc++.h> using namespace std; int main(){ long long x,p;cin>>x>>p;x=(x+1)/2*100; cout<<fixed<<setprecision(6)<<x/(double)p<<endl; return 0; }
#include <bits/stdc++.h> using namespace std; double solve(int x, double p) { if(x%2==1) return p*solve(x-1, p)+(1.0-p)*solve(x+1, p)+1.0; x/=2; return x/p; } int main() { int x, p; scanf("%d%d", &x, &p); printf("%.9f\n", solve(x, p/100.0)); return 0; }
#include <cmath> #include <iostream> #include <vector> #include <queue> #include <deque> #include <map> #include <set> #include <stack> #include <tuple> #include <bitset> #include <algorithm> #include <functional> #include <utility> #include <iomanip> #define int long long int #define rep(i, n) for(int i = 0; i < (n); ++i) using namespace std; typedef pair<int, int> P; const int INF = 1e15; const int MOD = 1e9+7; signed main(){ int x; double p; cin >> x >> p; cout << fixed << setprecision(7) << (x + 1) / 2 / p * 100.0 << endl; return 0; }
#include<bits/stdc++.h> using namespace std; double X; double P; int main() { cin >> X >> P; printf("%lf\n" ,50.0 * (X + ((int)X % 2)) / P); return 0; }
#include <bits/stdc++.h> using namespace std; int main(){ long long x; double p; cin>>x>>p; if(x%2){cout<<setprecision(20)<<(((double)x+1)/2)/p*100<<endl;} else{ cout<<setprecision(20)<<(((double)x)/2)/p*100<<endl;} }
#include <bits/stdc++.h> using namespace std; #define rep(i,x,y) for(int i=(x);i<(y);++i) #define debug(x) #x << "=" << (x) #ifdef DEBUG #define _GLIBCXX_DEBUG #define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl #else #define print(x) #endif const int inf=1e9; const int64_t inf64=1e18; const double eps=1e-9; template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (const auto &v : vec) { os << v << ","; } os << "]"; return os; } void solve(){ int x; double p; cin >> x >> p; p/=100; cout << (x+1)/2/p << endl; } int main(){ std::cin.tie(0); std::ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(10); solve(); return 0; }
#include <bits/stdc++.h> #define mp make_pair #define eb emplace_back #define ff first #define ss second using namespace std; typedef long long ll; typedef long double ld; #ifdef ONPC mt19937 rnd(228); #else mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); #endif const int MAXN = 100; //#define int long long const int INF = 1e9; /* task from atcoder: https://atcoder.jp/contests/cf16-tournament-round2-open/tasks/asaporo_e */ void solve(){ int x, p; cin >> x >> p; cout << fixed << setprecision(30) <<((ld)(x + x % 2) * 100.0) / ((ld)p * 2.0) << '\n'; } signed main() { #ifdef FILEIO freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); solve(); return 0; }
#include<bits/stdc++.h> using namespace std; typedef long long LL; struct cww{cww(){ ios::sync_with_stdio(false);cin.tie(0); cout<<fixed; cout<<setprecision(10); }}star; #define fin "\n" #define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++) #define REP(i,n) FOR(i,0,n) #define fi first #define se second #define pb push_back #define DEBUG if(0) template <typename T>inline void chmin(T &l,T r){l=min(l,r);} template <typename T>inline void chmax(T &l,T r){l=max(l,r);} template <typename T> istream& operator>>(istream &is,vector<T> &v){ for(auto &it:v)is>>it; return is; } double p; double f(LL x){ x/=2; return x/p; } int main(){ LL x; cin>>x>>p; p/=100; if(x%2)cout<<1+p*f(x-1)+(1-p)*f(x+1)<<endl; else cout<<f(x)<<endl; return 0; }
#include<bits/stdc++.h> using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(n);i++) #define pb push_back #define all(v) (v).begin(),(v).end() #define fi first #define se second typedef vector<int>vint; typedef pair<int,int>pint; typedef vector<pint>vpint; template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;} template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;} signed main(){ int x; double p; cin>>x>>p; p/=100; double ans; if(x&1){ ans=(1-p)*(x+1)/2/p+p*1.0*(x-1)/2/p+1; } else{ ans=x/2/p; } printf("%.20f\n",ans); return 0; }
#include<iostream> #include<algorithm> #include<vector> #include<queue> #include<iomanip> #define lol(i,n) for(int i=0;i<n;i++) #define mod 1000000007 typedef long long ll; using namespace std; int main(){ ll x,p;cin>>x>>p; cout<<fixed<<setprecision(10)<<(x+1)/2*100/(double)p<<endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main(){ int x; double p; cin >> x >> p; p /= 100.0; if(x % 2) { x /= 2; printf("%.9lf\n",x + (x + 1) / p * (1 - p) + 1); } else printf("%.9lf\n",x / 2 / p); return 0; }
#include <bits/stdc++.h> #define all(vec) vec.begin(),vec.end() #define mp make_pair using namespace std; using ll=long long; using P=pair<ll,ll>; const ll INF=1LL<<30; const ll LINF=1LL<<62; const double eps=1e-9; const ll MOD=1000000007LL; template<typename T>void chmin(T &a,T b){a=min(a,b);}; template<typename T>void chmax(T &a,T b){a=max(a,b);}; int dx[4]={0,1,0,-1}; int dy[4]={1,0,-1,0}; int main(){ ll x;double p;cin>>x>>p; double ans; if(x%2==0){ ans=(100.0/p)*(double)(x/2.0); }else{ ans=(p/100.0)*((100.0/p)*(double)((x-1.0)/2.0)+1)+((100.0-p)/100.0)*((100.0/p)*(double)(x+1.0)/2.0+1); } printf("%.10f\n",ans); }
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define sz(x) (int)((x).size()) #define jonathan ios_base::sync_with_stdio(0) #define livingston cin.tie(0) using namespace std; void yes() {cout << "Yes" << endl;} void no() {cout << "No" << endl;} int dx[] = {1, 0, -1, 0, -1, -1, 1, 1}; int dy[] = {0, 1, 0, -1, -1, 1, -1, 1}; const int INF = 1e9 + 9; const long long LINF = 1e18 + 8; const double EPS = 1e-9; const long long MOD = 1e9 + 7; //998244353 const double PI = acos(-1); void solve() { long long x, p; cin >> x >> p; cout << fixed << setprecision(6) << (double)((x + 1) / 2 * 100.0 / p) << endl; } int main() { jonathan; livingston; solve(); return 0; }
#include <iostream> #include <iomanip> #include <algorithm> #include <bitset> #include <set> #include <unordered_set> #include <map> #include <unordered_map> #include <cmath> #include <time.h> #include <random> #include <string> #include <cassert> #include <vector> #include <ostream> #include <istream> #include <stack> #include <deque> #include <queue> #include <functional> #include <chrono> #include <stack> using namespace std; #define int long long #define pb push_back #define all(a) (a).begin(), (a).end() #define pii pair<int, int> #define ld long double ostream& operator<< (ostream &out, const vector<int> &b) { for (auto k : b) out << k << " "; return out; } istream& operator>> (istream& in, pii& b) { in >> b.first >> b.second; return in; } ostream& operator<< (ostream& out, const pii& b) { out << "{" << b.first << ", " << b.second << "}"; return out; } template <typename T1, typename T2> inline bool chkmin(T1 &x, const T2 &y) {if (x > y) {x = y; return 1;} return 0;} template <typename T1, typename T2> inline bool chkmax(T1 &x, const T2 &y) {if (x < y) {x = y; return 1;} return 0;} #ifdef LOCAL #define dbg(x) cout << #x << " : " << (x) << "\n"; const int INF = 1e18; // const int mod = 2600000069; // const int p = 10; #else #define dbg(x) 57 const int INF = 1e18; // const int mod = 2600000069; // const int p = 179; #endif const ld PI = acos(-1); #define time clock() / (double) CLOCKS_PER_SEC // #pragma GCC optimize("Ofast,no-stack-protector") // #pragma GCC target("sse,sse2,sse3,sse3,sse4") // #pragma GCC optimize("unroll-loops") // #pragma GCC optimize("fast-math") // #pragma GCC target("avx2") // #pragma GCC optimize("section-anchors") // #pragma GCC optimize("profile-values,profile-reorder-functions,tracer") // #pragma GCC optimize("vpt") // #pragma GCC optimize("rename-registers") // #pragma GCC optimize("move-loop-invariants") // #pragma GCC optimize("unswitch-loops") // #pragma GCC optimize("function-sections") // #pragma GCC optimize("data-sections") mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count()); signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int x, p; cin >> x >> p; cout << fixed << setprecision(8); if (x & 1) { cout << ((100.0 - p) / 100.0 * (ld)(x + 1) / (ld)p * 100.0 + (ld)p / 100.0 * (ld)(x - 1) / (ld)p * 100.0) / 2.0 + 1.0 << "\n"; } else { cout << ((ld)x / (ld)p * 100.0) / 2.0 << "\n"; } } /* */
#include <algorithm> #include <cassert> #include <cctype> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define show(x) cout << #x << " = " << x << endl; using namespace std; using ll = long long; using pii = pair<int,int>; int main(){ int x; double p; cin >> x >> p; p/=100.0; if(1){ cout << fixed << setprecision(10) << (x+1)/2/p << endl; } }
#include<cstdio> #include<iostream> #include<vector> #include<string> #include<algorithm> #include<queue> #include<stack> #include<map> #include<set> #include<iomanip> #define rep0(i,N) for(int i=0;i<N;i++) #define rep1(i,a,N) for(int i=0+a;i<N;i++) #define lint long long int #define SIZE 100005 using namespace std; int main(){ double p; lint x; cin>>x>>p; double ans; double c; if(p==100){ if(x%2==0) cout<<x/2; else cout<<(x+1)/2; return 0; } if(x%2==1) x++; c=-1*p/100+1*(100-p)/100; ans=x/(1-c); cout<< fixed << setprecision(8) << ans; return 0; }
// #include {{{ #include <iostream> #include <cassert> #include <cstring> #include <cstdlib> #include <cstdio> #include <cctype> #include <cmath> #include <ctime> #include <queue> #include <set> #include <map> #include <stack> #include <string> #include <bitset> #include <vector> #include <complex> #include <algorithm> using namespace std; // }}} // #define {{{ typedef long long ll; typedef double db; typedef pair<int,int> pii; typedef vector<int> vi; #define de(x) cout << #x << "=" << x << endl #define rep(i,a,b) for(int i=a;i<(b);++i) #define per(i,a,b) for(int i=(b)-1;i>=(a);--i) #define all(x) (x).begin(),(x).end() #define sz(x) (int)(x).size() #define mp make_pair #define pb push_back #define fi first #define se second // }}} int x , p; int main(){ scanf("%d%d",&x,&p); db ans = 0.; if(x & 1) ans = 1 + ((x - 1) / 2 + (100. - p) / p * (x + 1) / 2); else ans = 100. / p * x / 2; printf("%.12f\n",ans); return 0; }
#include <iostream> #include <vector> #include <string> #include <cmath> #include <algorithm> #include <utility> #include <queue> #include <set> #include <map> #include <deque> #include <iomanip> #include <cstdio> using namespace std; typedef long long ll; typedef pair<int,int> PII; typedef vector<int> VI; typedef vector<VI> VVI; #define MP make_pair #define PB push_back #define inf 1000000007 #define rep(i,n) for(int i=0;i<(int)(n);++i) double calc(int x,double pp){ return ((double)x/2.0)/pp; } int main(){ int x; int p; cin >> x >> p; double pp = (double)p/100.0; if(x%2==0){ cout << fixed << setprecision(10) << calc(x,pp) << endl; }else{ cout << fixed << setprecision(10) << 1.0+pp*calc(x-1,pp)+(1.0-pp)*calc(x+1,pp) << endl; } return 0; }
# include "bits/stdc++.h" using namespace std; using LL = long long; using ULL = unsigned long long; const double PI = acos(-1); template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); } template<class T>constexpr T HINF() { return INF<T>() / 2; } template <typename T_char>T_char TL(T_char cX) { return tolower(cX); }; template <typename T_char>T_char TU(T_char cX) { return toupper(cX); }; const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 }; const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 }; int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; } int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; } int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; } LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); }; LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; }; # define ALL(qpqpq) (qpqpq).begin(),(qpqpq).end() # define UNIQUE(wpwpw) (wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end()) # define LOWER(epepe) transform(ALL((epepe)),(epepe).begin(),TL<char>) # define UPPER(rprpr) transform(ALL((rprpr)),(rprpr).begin(),TU<char>) # define FOR(i,tptpt,ypypy) for(LL i=(tptpt);i<(ypypy);i++) # define REP(i,upupu) FOR(i,0,upupu) # define INIT std::ios::sync_with_stdio(false);std::cin.tie(0) # pragma warning(disable:4996) double n; double p; int main() { cin >> n >> p; p /= 100.0; cout << fixed << setprecision(13) << ceil(n / 2) / p << endl; }
#include <bits/stdc++.h> #include <random> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef long double ld; #define int ll typedef vector<char> vc; typedef vector<vc> vvc; typedef vector<vvc> vvvc; typedef pair<int, int> pii; typedef pair<pii, pii> piii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<pii> vpi; typedef vector< vi > vvi; typedef vector< vvi > vvvi; typedef vector<short> vs; typedef vector<vs> vvs; typedef vector<vvs> vvvs; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<vvl> vvvl; typedef vector<ld> vld; typedef vector<vld> vvld; typedef vector<vvld> vvvld; typedef vector<string> vst; typedef vector<vst> vvst; typedef pair<ld, ld> pld; #define inmin(a, b) a = min(a, (b)) #define inmax(a, b) a = max(a, (b)) #define ALL(a) a.begin(),a.end() #define RALL(a) a.rbegin(),a.rend() #define sqr(x) ((x) * (x)) #define fori(i, n) for(int i = 0; i < int(n); ++i) #define SZ(a) ((int)((a).size())) #define triple(T) tuple<T, T, T> #define quad(T) tuple<T, T, T, T> #define watch(x) cerr << (#x) << " = " << (x) << endl; #ifdef RUS_HOME #define cerr cout #else #define cerr if (false) cerr #endif const double PI = 2 * acos(0.0); #define rand shittttty_shit mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count()); const string DIGITS = "0123456789"; const string ALPH = "abcdefghijklmnopqrstuvwxyz"; template <class T0, class T1> inline ostream & operator << (ostream &out, pair<T0, T1> &a) { return out << "{" << a.first << ", " << a.second << "}"; } template <class T0, class T1> inline istream & operator >> (istream &in, pair<T0, T1> &a) { return in >> a.first >> a.second; } template <class T0, class T1, class T2> inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) { return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}"; } template <class T0, class T1, class T2, class T3> inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) { return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " << get<3>(a) << "}"; } template<class T> inline ostream & operator << (ostream &out, vector<T> &a) { out << "["; fori (i, a.size()) out << a[i] << vector<string>{", ", "] "}[i + 1 == a.size()]; return out; } void smain(); signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifdef RUS_HOME freopen("input", "r", stdin); //freopen("output.txt", "w", stdout); clock_t start = clock(); #endif cout << setprecision(12) << fixed; smain(); #ifdef RUS_HOME cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) / CLOCKS_PER_SEC << endl; #endif return 0; } const int MOD=1e9+7,N=1e5+1,M=4e5+100,oo=1e9; void smain() { int x,p; cin>>x>>p; cout<<(ld)((x/2+x%2)*100)/p; }
#include<bits/stdc++.h> using namespace std; int main(){ long x,p;cin>>x>>p; cout<<fixed<<setprecision(10)<<50.0*(x+x%2)/p; }
#include <iostream> #include <algorithm> #include <vector> #include <iomanip> #include <map> #include <queue> static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using namespace std; template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208; int main() { ll x, p; cin >> x >> p; ll k = (x+1)/2; printf("%.15Lf", (100/(long double)p)*k); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int X, P; cin >> X >> P; int a = (X + 1) / 2; double p = P / 100.0; cout << fixed << setprecision(9) << 1 / p * a << endl; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,a) for(int i=0;i<(a);i++) const ll MOD=1000000007; // 1ターン分プラスして, // dp_x=1+dp_(x-2)*P/100+dp_x*(100-p)/100 // dp_x=dp_(x-2)+100/p int main(){ ll x; cin>>x; double p; cin>>p; if(x%2) x++; cout<<setprecision(15); cout<<x/2*100/p<<endl; return 0; }
#include <cstdio> #include <algorithm> #include <cmath> #include <queue> #include <vector> #include <map> #include <set> using namespace std; typedef pair<int , int> P2; typedef pair<pair<int , int> , int> P3; typedef pair<pair<int , int> , pair<int , int> > P4; #define Fst first #define Snd second #define PB(a) push_back(a) #define MP(a , b) make_pair((a) , (b)) #define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c)) #define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d))) #define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i) #define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i) #define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it) int x,p; double solve(int n){ return 100.0 * n / p; } int main(){ scanf("%d%d" , &x , &p); if(p == 100){ printf("%d\n" , (x+1) / 2); } else if(x%2==0){ printf("%.9f\n" , solve(x/2)); } else { printf("%.9f\n" , 1.0 + solve(x/2)*0.01*p + solve(x/2+1)*0.01*(100-p)); } return 0; }
#include<bits/stdc++.h> using namespace std; typedef long long ll; signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20); ll x; cin>>x; double p; cin>>p; if(abs(p-100)<0.01){ x++; cout << x/2 << endl; return 0; } p/=100.0; if(x%2==0){ cout << (double)x/2.0/p << "\n"; } else{ x++; cout << (double)x/2.0/p << "\n"; } }
#include<stdio.h> #include<vector> #include<algorithm> using namespace std; int main() { int num,pr; scanf("%d%d",&num,&pr); if(num%2==1)num++; printf("%lf\n",(double)num/(1.0-double(100-pr)/double(100)+double(pr)/double(100))); }
#include "bits/stdc++.h" #include <unordered_set> #define _CRT_SECURE_NO_WARNINGS #define FOR(i, x, n) for(decltype(x) i = (x); i < (n); i++) #define REP(i, n) for(decltype(n) i = 0; i < (n); i++) #define RREP(i, n) for (decltype(n) i = (n) - 1; i >= 0; i--) #define ALL(a) (a).begin(),(a).end() #define SORT(c) sort((c).begin(),(c).end()) #define DESCSORT(c) sort(c.begin(), c.end(), greater<int>()) using namespace std; const int dy[] = { 0, 1, 0, -1 }; const int dx[] = { 1, 0, -1, 0 }; using LL = long long int; using LD = long double; const int INF = (1 << 30) - 1; const LL INF64 = ((LL)1 << 62) - 1; const double PI = 3.1415926535897932384626433832795; using pii = pair<int, int>; using pll = pair<LL, LL>; using pdd = pair<double, double>; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; using vl = vector<LL>; using vvl = vector<vl>; using vvvl = vector<vvl>; using vd = vector<double>; using vvd = vector<vd>; using vs = vector<string>; using vb = vector<bool>; using vvb = vector<vb>; int main() { // ios::sync_with_stdio(false); // cin.tie(0); int x, p; cin >> x >> p; double ans = (x + 1) / 2 * 100.0 / p; printf("%.7lf\n", ans); return 0; }
#include <bits/stdc++.h> #include <random> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef double ld; //#define ll __int128 //#define int ll //#define char ll //#define double ld typedef vector<char> vc; typedef vector <vc> vvc; typedef vector <vvc> vvvc; typedef pair<int, int> pii; typedef pair<pii, pii> piii; typedef pair<ll, ll> pll; typedef vector <int> vi; typedef vector <pii> vpi; typedef vector <vi> vvi; typedef vector <vvi> vvvi; typedef vector<short> vs; typedef vector <vs> vvs; typedef vector <vvs> vvvs; typedef vector <ll> vl; typedef vector <vl> vvl; typedef vector <vvl> vvvl; typedef vector <ld> vld; typedef vector <vld> vvld; typedef vector <vvld> vvvld; typedef vector <string> vst; typedef vector <vst> vvst; typedef pair<ld, ld> pld; #define inmin(a, b) a = min(a, (b)) #define inmax(a, b) a = max(a, (b)) #define ALL(a) a.begin(),a.end() #define RALL(a) a.rbegin(),a.rend() #define sqr(x) ((x) * (x)) #define fori(i, n) for(int i = 0; i < int(n); ++i) #define SZ(a) ((int)((a).size())) #define triple(T) tuple<T, T, T> #define quad(T) tuple<T, T, T, T> #define watch(x) cerr << (#x) << " = " << (x) << endl; #ifdef MAX_HOME #define cerr cout #else #define cerr if (false) cerr #endif const double PI = 2 * acos(0.0); #define rand shittttty_shit mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count()); const string DIGITS = "0123456789"; const string ALPH = "abcdefghijklmnopqrstuvwxyz"; template<class T0, class T1> inline ostream &operator<<(ostream &out, pair<T0, T1> &a) { return out << "{" << a.first << ", " << a.second << "}"; } template<class T0, class T1> inline istream &operator>>(istream &in, pair<T0, T1> &a) { return in >> a.first >> a.second; } template<class T0, class T1, class T2> inline ostream &operator<<(ostream &out, tuple<T0, T1, T2> &a) { return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}"; } template<class T0, class T1, class T2, class T3> inline ostream &operator<<(ostream &out, tuple<T0, T1, T2, T3> &a) { return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " << get<3>(a) << "}"; } template<class T> inline ostream &operator<<(ostream &out, vector <T> &a) { out << "["; fori (i, a.size())out << a[i] << vector < string > {", ", "] "}[i + 1 == a.size()]; return out; } void smain(); signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifdef MAX_HOME freopen("input.txt", "r", stdin); clock_t start = clock(); #endif #ifdef HK_CUP freopen("finput.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif cout << setprecision(12) << fixed; smain(); #ifdef MAX_HOME #ifndef HK_CUP cout << "\n\nTOTAL EXECUTION TIME: " << float(clock() - start) / CLOCKS_PER_SEC << endl; #endif #endif return 0; } ld f(ll x, ld p) { return x / p; } void smain() { ll x; ld p; cin >> x >> p; p /= 100; ld ans = 0; if (x & 1) { ans = 1 + p * f((x - 1) / 2, p) + (1 - p) * f((x + 1) / 2, p); } else { ans = f(x / 2, p); } cout << ans; }
#include <bits/stdc++.h> using namespace std; int main(){ int x, p; cin >> x >> p; x = (x + 1) / 2; cout << fixed << setprecision(12) << 100. / p * x << endl; return 0; }
#include <iostream> #include <fstream> #include <cstdio> #include <cmath> #include <vector> #include <cstring> #include <string> #include <set> #include <map> #include <stack> #include <queue> #include <algorithm> using namespace std; #define REP(i,n) for(int i=0; i<n; ++i) #define FOR(i,a,b) for(int i=a; i<=b; ++i) #define FORR(i,a,b) for (int i=a; i>=b; --i) #define pi M_PI typedef long long ll; typedef vector<int> VI; typedef vector<ll> VL; typedef vector<VI> VVI; typedef pair<int,int> P; typedef pair<ll,ll> PL; int main() { int x; double p; cin >> x >> p; x = (x+1)/2; printf("%.10f\n", x/(p/100)); return 0; }
#include <string> #include <queue> #include <stack> #include <vector> #include <sstream> #include <algorithm> #include <deque> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <list> #include <cstdio> #include <iostream> #include <cmath> #include <climits> #include <bitset> #include <functional> #include <numeric> #include <ctime> #include <cassert> #include <cstring> #include <fstream> #define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++) #define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++) #define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--) using namespace std; int main() { int x, p; cin >> x >> p; if (p == 100) { int tim = (x+1) / 2; cout << tim << endl; return 0; } 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; }
#include <bits/stdc++.h> #include<iostream> #include<cstdio> #include<vector> #include<queue> #include<map> #include<cstring> #include<string> #include <math.h> #include<algorithm> // #include <boost/multiprecision/cpp_int.hpp> #include<functional> #define int long long #define inf 1000000007 #define pa pair<int,int> #define ll long long #define pal pair<double,pa> #define ppa pair<pa,int> #define ppap pair<int,pa> #define ssa pair<string,int> #define mp make_pair #define pb push_back #define EPS (1e-10) #define equals(a,b) (fabs((a)-(b))<EPS) using namespace std; class Point{ public: double x,y; Point(double x=0,double y=0):x(x),y(y) {} Point operator + (Point p) {return Point(x+p.x,y+p.y);} Point operator - (Point p) {return Point(x-p.x,y-p.y);} Point operator * (double a) {return Point(x*a,y*a);} Point operator / (double a) {return Point(x/a,y/a);} double absv() {return sqrt(norm());} double norm() {return x*x+y*y;} bool operator < (const Point &p) const{ return x != p.x ? x<p.x: y<p.y; } bool operator == (const Point &p) const{ return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS; } }; typedef Point Vector; struct Segment{ Point p1,p2; }; double dot(Vector a,Vector b){ return a.x*b.x+a.y*b.y; } double cross(Vector a,Vector b){ return a.x*b.y-a.y*b.x; } class pa3{ public: int x,y,z; pa3(int x=0,int y=0,int z=0):x(x),y(y),z(z) {} bool operator < (const pa3 &p) const{ if(x!=p.x) return x<p.x; if(y!=p.y) return y<p.y; return z<p.z; //return x != p.x ? x<p.x: y<p.y; } bool operator > (const pa3 &p) const{ if(x!=p.x) return x>p.x; if(y!=p.y) return y>p.y; return z>p.z; //return x != p.x ? x<p.x: y<p.y; } bool operator == (const pa3 &p) const{ return x==p.x && y==p.y && z==p.z; } bool operator != (const pa3 &p) const{ return !( x==p.x && y==p.y && z==p.z); } }; bool parareru(Point a,Point b,Point c,Point d){ // if(abs(cross(a-b,d-c))<EPS)cout<<"dd "<<cross(a-b,d-c)<<endl; return abs(cross(a-b,d-c))<EPS; } double distance_ls_p(Point a, Point b, Point c) { if ( dot(b-a, c-a) < EPS ) return (c-a).absv(); if ( dot(a-b, c-b) < EPS ) return (c-b).absv(); return abs(cross(b-a, c-a)) / (b-a).absv(); } bool is_intersected_ls(Segment a,Segment b) { if(a.p1==b.p1||a.p2==b.p1||a.p1==b.p2||a.p2==b.p2) return false; if(parareru((a.p2),(a.p1),(a.p1),(b.p2))&&parareru((a.p2),(a.p1),(a.p1),(b.p1))){ // cout<<"sss"<<endl; if(dot(a.p1-b.p1,a.p1-b.p2)<EPS) return true; if(dot(a.p2-b.p1,a.p2-b.p2)<EPS) return true; if(dot(a.p1-b.p1,a.p2-b.p1)<EPS) return true; if(dot(a.p1-b.p2,a.p2-b.p2)<EPS) return true; return false; } else return ( cross(a.p2-a.p1, b.p1-a.p1) * cross(a.p2-a.p1, b.p2-a.p1) < EPS ) && ( cross(b.p2-b.p1, a.p1-b.p1) * cross(b.p2-b.p1, a.p2-b.p1) < EPS ); } double segment_dis(Segment a,Segment b){ if(is_intersected_ls(a,b))return 0; double r=distance_ls_p(a.p1, a.p2, b.p1); r=min(r,distance_ls_p(a.p1, a.p2, b.p2)); r=min(r,distance_ls_p(b.p1, b.p2, a.p2)); r=min(r,distance_ls_p(b.p1, b.p2, a.p1)); return r; } Point intersection_ls(Segment a, Segment b) { Point ba = b.p2-b.p1; double d1 = abs(cross(ba, a.p1-b.p1)); double d2 = abs(cross(ba, a.p2-b.p1)); double t = d1 / (d1 + d2); return a.p1 + (a.p2-a.p1) * t; } string itos( int i ) { ostringstream s ; s << i ; return s.str() ; } int gcd(int v,int b){ if(v>b) return gcd(b,v); if(v==b) return b; if(b%v==0) return v; return gcd(v,b%v); } double distans(double x1,double y1,double x2,double y2){ double rr=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); return sqrt(rr); } /* int pr[100010]; //int inv[100010]; */ int beki(int wa,int rr,int warukazu){ if(rr==0) return 1ll; if(rr==1) return wa%warukazu; if(rr%2==1) return (beki(wa,rr-1,warukazu)*wa)%warukazu; int zx=beki(wa,rr/2,warukazu); return (zx*zx)%warukazu; } // cin.tie(0); //ios::sync_with_stdio(false); /* void gya(){ pr[0]=1; for(int i=1;i<100010;i++){ pr[i]=(pr[i-1]*i)%inf; } for(int i=0;i<100010;i++) inv[i]=beki(pr[i],inf-2); } */ //sort(ve.begin(),ve.end(),greater<int>()); //----------------kokomade tenpure------------ //vector<double> ans(100000000),ans2(100000000); int par[200100],ranks[200100],kosuu[200100]; void shoki(int n){ for(int i=0;i<n;i++){ par[i]=i; ranks[i]=0; kosuu[i]=1; } } int root(int x){ return par[x]==x ? x : par[x]=root(par[x]); } bool same(int x,int y){ return root(x)==root(y); } void unite(int x,int y){ x=root(x); y=root(y); int xx=kosuu[x],yy=kosuu[y]; if(x==y) return; if(ranks[x]<ranks[y]){ par[x]=y; kosuu[y]=yy+xx; } else { par[y]=x; if(ranks[x]==ranks[y]) ranks[x]=ranks[x]+1; kosuu[x]=yy+xx; } return; } vector<int> ve; int ans[100020]; int w[100020]; int x[100020]; int n,l,t; int f(int r){ if(r>=0){ return r%n; } int rr=-r; int g=rr/n+1; rr-=g*n; return f(-rr); } signed main(){ cin.tie(0); ios::sync_with_stdio(false); int x; double p; cin>>x>>p; p/=100.0; x=(x+1)/2; printf("%.10lf\n",x/p); }
#include<bits/stdc++.h> using namespace std; int main () { long long x,p; double ans; cin >> x >> p; if (x % 2 == 0) { x /= 2; ans = x; ans *= 100; ans /= p; } else { x /= 2; ans = x*p + (x+1)*(100-p); ans /= p; ans += 1; } cout << fixed << setprecision(10) << ans << endl; }
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ double x,p;cin>>x>>p; int y=x; double iti=(100-2*p)/(double)100; if((int)y%2==1)x+=iti; double ans=x/(1-iti); if((int)y%2==1){ ans+=1.0; } cout<<fixed<<setprecision(12)<<ans<<endl; }
#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define MT make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)<<endl #define smax(x,y) (x)=max((x),(y)) #define smin(x,y) (x)=min((x),(y)) #define MEM(x,y) memset((x),(y),sizeof (x)) #define sz(x) (int)(x).size() #define RT return using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vll = vector<ll>; void solve() { int X, P; cin >> X >> P; double p = P / 100.0; auto f = [&](int x) { return x / (2 * p); }; if (X % 2 == 0) { cout << f(X) << endl; } else { cout << 1 + f(X - 1)*p + f(X + 1)*(1 - p) << endl; } } int main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15); solve(); return 0; }
#include <bits/stdc++.h> using namespace std; #define INF_LL (int64)1e18 #define INF (int32)1e9 #define REP(i, n) for(int i = 0;i < (n);i++) #define FOR(i, a, b) for(int i = (a);i < (b);i++) #define all(x) x.begin(),x.end() #define fs first #define sc second using int32 = int_fast32_t; using uint32 = uint_fast32_t; using int64 = int_fast64_t; using uint64 = uint_fast64_t; using PII = pair<int32, int32>; using PLL = pair<int64, int64>; const double eps = 1e-6; template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;} template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;} const int64 mod = 1e9+7; double res = 0; double P; double E(int64 x){ double num = 1/P; return num*x/2; } int main(void){ int64 x; cin >> x >> P; P /= 100; if(x%2){ res = 1; res += E(x-1)*P; res += E(x+1)*(1-P); }else{ res += E(x); } cout << fixed << setprecision(10) << res << endl; }
#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); }
#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; }
#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; }
#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; }
#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; }
#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; }
#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; }
#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; }
#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); }
#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; }
#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); }
#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); }
#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; }
#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; }
#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; }
#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; }
#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; }