結果
問題 |
No.219 巨大数の概算
|
ユーザー |
|
提出日時 | 2025-03-04 12:59:01 |
言語 | Perl (5.40.0) |
結果 |
AC
|
実行時間 | 339 ms / 1,500 ms |
コード長 | 802 bytes |
コンパイル時間 | 403 ms |
コンパイル使用メモリ | 8,988 KB |
実行使用メモリ | 44,876 KB |
最終ジャッジ日時 | 2025-03-04 12:59:21 |
合計ジャッジ時間 | 19,203 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
外部呼び出し有り |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 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); } }