結果

問題 No.379 五円硬貨
ユーザー haruteru
提出日時 2016-06-24 09:39:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 416 bytes
コンパイル時間 533 ms
コンパイル使用メモリ 54,008 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 20:11:53
合計ジャッジ時間 1,146 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <stdio.h>
using namespace std;
typedef long long INT;

INT gcd(INT a, INT b)
{
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main()
{
    INT N, G, V, GCD;
    cin >> N;
    cin >> G;
    cin >> V;

    G = N / 5 * G;
    GCD = gcd(G, V);
    G /= GCD;
    V /= GCD;

    INT n = G / V;
    cout << n << ".";
    n = G - (n * V);
    cout << n * 100000000000 / V << endl;
}
0