[C++] AtCoder Beginner Contest 193 A번 Discount

AtCoder Beginner Contest 193 A번 Discount

문제

https://atcoder.jp/contests/abc193/tasks/abc193_a abc193_a

풀이

A가 B가 된다면 몇퍼센트의 할인이 적용된 것인지를 묻는 문제

100(1 - B/A) 를 출력하면 정답

물론 소수점 이하 두자리까지 정확도를 보장해야한다.

코드

#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef tuple<ll, ll, ll> tl3;
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
#define rep(i, n) FOR(i, 0, n)
#define repn(i, n) FORN(i, 1, n)
#define tc(t) while (t--)
// https://atcoder.jp/contests/abc193/tasks/abc193_a
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll a,b;
    cin >> a >> b;
    ld ans = (ld)100.0 - (ld)b/a*100;
    cout << fixed;
    cout.precision(20);
    cout << ans;

    return 0;
}