結果

問題 No.379 五円硬貨
ユーザー haruteruharuteru
提出日時 2016-06-24 09:39:32
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 416 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 54,728 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-20 01:21:46
合計ジャッジ時間 996 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,948 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 WA -
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 1 ms
6,944 KB
testcase_15 WA -
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

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