結果
問題 |
No.219 巨大数の概算
|
ユーザー |
|
提出日時 | 2017-07-27 16:59:20 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 979 bytes |
コンパイル時間 | 701 ms |
コンパイル使用メモリ | 81,780 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-10 02:10:43 |
合計ジャッジ時間 | 17,608 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 5 TLE * 46 |
ソースコード
#include<cstdio> #include<iostream> #include<algorithm> #include<string> #include<queue> #include<vector> #include<functional> #include<cmath> #include<map> #include<stack> #include<set> #include<numeric> #include<limits> #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef pair<ll, string> pls; double logbase(double a, double base) { return log(a) / log(base); } int main() { int N; cin >> N; for (int i = 0; i < N; i++) { double A, B; cin >> A >> B; double mi = 1000000000,num,x_mi,y_mi,z_mi; for (int x = 1; x <= 9; x++) { for (int y = 1; y <= 9; y++) { for (int z = 1; z <= 100; z++) { num = abs(B - logbase(x+y*0.1,A) - z/logbase(A,10)); if (mi > num) { mi = num; x_mi = x; y_mi = y; z_mi = z; } } } } cout << x_mi << " " << y_mi << " " << z_mi << endl; } return 0; }