結果
問題 |
No.219 巨大数の概算
|
ユーザー |
|
提出日時 | 2019-10-12 05:44:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 602 bytes |
コンパイル時間 | 447 ms |
コンパイル使用メモリ | 65,004 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-27 03:29:50 |
合計ジャッジ時間 | 10,299 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 51 |
コンパイルメッセージ
main.cpp:29:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 29 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; struct A{ long X,Y,Z; A&operator*=(const A&B){ Z+=B.Z-2; long T=(X*10+Y)*(B.X*10+B.Y); while(T>=100) { Z+=1; T/=10; } X=T/10,Y=T%10; return*this; } }; A power(A a,int b) { if(b) { A x=a; x*=a; A y=power(x,b/2); if(b&1)y*=a; return y; } else return (A){1,0,0}; } main() { int N; cin>>N; for(;N--;) { int a,b;cin>>a>>b; A x{0,0,0}; while(a>=100) { x.Z+=1; a/=10; } if(a>=10) { x.X=a/10; x.Y=a%10; } else { x.X=a; x.Z+=1; } x=power(x,b); cout<<x.X<<" "<<x.Y<<" "<<x.Z<<endl; } }