結果

問題 No.219 巨大数の概算
ユーザー ciel
提出日時 2015-05-25 01:33:31
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 7 ms / 1,500 ms
コード長 442 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 46,464 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 10:31:22
合計ジャッジ時間 2,608 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 51
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         for(scanf("%d",&N);N--;){
      |             ~~~~~^~~~~~~~~
main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |                 scanf("%lld%lld",&A,&B);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

int main(){
	vector<double>t(101);
	for(int i=10;i<101;i++)t[i]=log10(i);
	int N;
	for(scanf("%d",&N);N--;){
		long long A,B;
		scanf("%lld%lld",&A,&B);
		double result=log10(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);
	}
}
0