結果

問題 No.285 消費税2
ユーザー moti
提出日時 2015-10-17 10:17:46
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 292 bytes
コンパイル時間 535 ms
コンパイル使用メモリ 57,428 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-22 10:05:02
合計ジャッジ時間 1,528 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: format ‘%ld’ expects argument of type ‘long int*’, but argument 2 has type ‘long long unsigned int*’ [-Wformat=]
    5 | scanf("%ld", &d);
      |        ~~^   ~~
      |          |   |
      |          |   long long unsigned int*
      |          long int*
      |        %lld
main.cpp:5:6: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 | scanf("%ld", &d);
      | ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <iostream>
#include <sstream>
int main() {unsigned long long d;
scanf("%ld", &d);
unsigned long long f = d*108;
std::stringstream ss; ss<<f;
std::string s1; ss >> s1;
std::cout << s1.substr(0, s1.size()-2) << "." << s1.substr(s1.size()-2) << std::endl;
return 0;
}
0