結果

問題 No.2407 Bouns 2.0
ユーザー nhtloc
提出日時 2025-09-04 03:51:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 882 bytes
コンパイル時間 1,944 ms
コンパイル使用メモリ 196,024 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-04 03:51:54
合計ジャッジ時間 3,217 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

long long parse_b10(const string& s) {
    // Trả về b10 = 10*B, với B có tối đa 1 chữ số thập phân.
    auto pos = s.find('.');
    if (pos == string::npos) return stoll(s) * 10;
    string a = s.substr(0, pos);
    string b = s.substr(pos + 1); // phần thập phân
    if (b.empty()) b = "0";
    // chỉ lấy 1 chữ số thập phân theo đề
    if (b.size() > 1) b = b.substr(0, 1);
    return stoll(a) * 10 + stoll(b);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    long long W, Z; string B;
    if (!(cin >> W >> Z >> B)) return 0;
    long long b10 = parse_b10(B);            // b10 = 10*B
    long long S = W + Z;                     // tổng giá
    long long ans = S * (10 + b10) / 10;     // luôn chia hết theo ràng buộc
    cout << ans << '\n';
    return 0;
}
0