結果
問題 |
No.219 巨大数の概算
|
ユーザー |
|
提出日時 | 2025-03-04 12:56:55 |
言語 | Perl (5.40.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 803 bytes |
コンパイル時間 | 571 ms |
コンパイル使用メモリ | 9,120 KB |
実行使用メモリ | 45,632 KB |
最終ジャッジ日時 | 2025-03-04 12:57:19 |
合計ジャッジ時間 | 23,554 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 51 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
#!/usr/bin/perl #その他行きでおk☆ ToT #提出が安定しない… local $/; open(my $fh,'| g++ -xc++ -std=c++11 -o/tmp/Z - -lquadmath'); print $fh <DATA>; close($fh); open($fh,'| ./tmp/Z'); print $fh <STDIN>; close($fh); unlink('/tmp/Z'); __END__ #include <vector> #include <algorithm> #include <cstdio> #include <quadmath.h> using namespace std; int main(){ vector<__float128>t(101); for(int i=10;i<101;i++)t[i]=log10q(__float128(i)); int N; for(scanf("%d",&N);N--;){ long long A,B; scanf("%lld%lld",&A,&B); __float128 result=log10q(__float128(A))*B; long long Z=result; result-=Z-1; auto it=upper_bound(t.begin(),t.end(),result);--it; int X=distance(t.begin(),it); printf("%d %d %lld\n",X/10,X%10,Z); } }