結果
問題 | No.219 巨大数の概算 |
ユーザー |
![]() |
提出日時 | 2015-05-29 22:41:56 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,899 bytes |
コンパイル時間 | 491 ms |
コンパイル使用メモリ | 84,268 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-06 11:42:49 |
合計ジャッジ時間 | 14,237 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 51 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:75:40: warning: ‘ansY’ may be used uninitialized in this function [-Wmaybe-uninitialized] 75 | cout << ansX << " " << ansY << " " << ((int)l) << endl; | ^~~ main.cpp:75:25: warning: ‘ansX’ may be used uninitialized in this function [-Wmaybe-uninitialized] 75 | cout << ansX << " " << ansY << " " << ((int)l) << endl; | ^~~
ソースコード
#include <map> #include <set> #include <list> #include <cmath> #include <queue> #include <stack> #include <cstdio> #include <string> #include <vector> #include <complex> #include <cstdlib> #include <cstring> #include <numeric> #include <sstream> #include <iostream> #include <algorithm> #include <functional> #define mp make_pair #define pb push_back #define all(x) (x).begin(),(x).end() #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<vb> vvb; typedef vector<vi> vvi; typedef pair<int,int> pii; const int INF=1<<29; const double EPS=1e-9; const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1}; int main() { int N; cin >> N; for (int i = 0; i < N; i++) { int a, b; cin >> a >> b; double l = ((double)b) * log10(a); double ll = l - ((int)l); int ansX, ansY, ansZ; for (int X = 1; X <= 9; X++) { for (int Y = 0; Y <= 9; Y++) { for (int Z = 0; Z <= 9; Z++) { double now = X + ((double)Y) / 10.0 + ((double)Z) / 100.0; if (log10(now) >= ll) { ansX = X; ansY = Y; ansZ = Z; if (Z == 0) { if (ansY == 0) { ansX--; ansY = 9; } else { ansY--; } } goto en; } } } } en: cout << ansX << " " << ansY << " " << ((int)l) << endl; } return 0; }