結果
| 問題 |
No.25 有限小数
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-02-25 17:32:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 484 bytes |
| コンパイル時間 | 712 ms |
| コンパイル使用メモリ | 58,064 KB |
| 実行使用メモリ | 14,024 KB |
| 最終ジャッジ日時 | 2024-06-23 23:26:26 |
| 合計ジャッジ時間 | 7,385 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 TLE * 1 -- * 7 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
long long n, m;
while (cin>>n>>m) {
auto g=__gcd(n, m);
n/=g, m/=g;
int c2=0, c5=0;
while (m%2==0) { m/=2; ++c2; }
while (m%5==0) { m/=5; ++c5; }
if (m>1)
cout<<-1<<endl;
else {
while (c5--) n=n*2%10;
while (c2--) n=n*5%10;
while (n%10==0) n/=10;
cout<<n%10<<endl;
}
}
}
hogeover30