結果
問題 | No.219 巨大数の概算 |
ユーザー |
![]() |
提出日時 | 2015-07-31 16:23:06 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 18 ms / 1,500 ms |
コード長 | 1,119 bytes |
コンパイル時間 | 611 ms |
コンパイル使用メモリ | 82,872 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 11:20:23 |
合計ジャッジ時間 | 3,911 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 51 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:48:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 48 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:51:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 51 | scanf("%lf %lf", &a, &b); | ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <algorithm> #include <vector> #include <cfloat> #include <string> #include <cmath> #include <set> #include <cstdlib> #include <map> #include <ctime> #include <iomanip> #include <functional> #include <deque> #include <iostream> #include <cstring> #include <queue> #include <cstdio> #include <stack> #include <climits> #include <sys/time.h> #include <cctype> using namespace std; typedef long long ll; double mlog10[101]; void solve(double &x, double &y, double &z) { double az; double t; t = modf(y*log10(x), &az); for (int i = 1; i < 100; i++) { if (mlog10[i] <= t && t < mlog10[i+1]) { x = i/10; y = i%10; break; } } z = az; } int main() { for (int i = 1; i <= 100; i++) { mlog10[i] = log10(double(i)/10.); } int n; scanf("%d", &n); for (int i = 0; i < n; i++) { double a, b; scanf("%lf %lf", &a, &b); double x, y, z; x = a; y = b; z = 0; solve(x, y, z); printf("%.0lf %.0lf %.0lf\n", x, y, z); } // ll x, y, z; // scanf("%lld %lld %lld", &x, &y, &z); // convert(x, y, z); // printf("%lld %lld %lld\n", x, y, z); }