結果
| 問題 | No.25 有限小数 |
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-02-25 12:33:18 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 548 bytes |
| 記録 | |
| コンパイル時間 | 513 ms |
| コンパイル使用メモリ | 92,876 KB |
| 実行使用メモリ | 794,800 KB |
| 最終ジャッジ日時 | 2026-03-09 06:37:12 |
| 合計ジャッジ時間 | 37,721 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 WA * 1 TLE * 5 MLE * 6 |
ソースコード
#include <iostream>
#include <algorithm>
#include <unordered_set>
using namespace std;
int main()
{
long long n, m;
while (cin>>n>>m) {
unordered_set<long long> s;
auto res=-1LL;
while (true) {
auto t=n%m;
if (!t) {
n/=m;
while (n%10==0) n/=10;
res=n%10;
break;
}
if (s.count(t)) { res=-1; break; }
s.insert(t);
n%=m;
n*=10;
}
cout<<res<<endl;
}
}
hogeover30