結果
| 問題 | No.25 有限小数 |
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2015-07-29 19:35:25 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 822 bytes |
| 記録 | |
| コンパイル時間 | 589 ms |
| コンパイル使用メモリ | 100,364 KB |
| 実行使用メモリ | 108,208 KB |
| 最終ジャッジ日時 | 2026-04-01 13:19:43 |
| 合計ジャッジ時間 | 9,082 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 2 TLE * 1 -- * 11 |
ソースコード
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>
typedef long long ll;
using namespace std;
#define mod 1000003
#define INF 1000000000
#define LLINF 2000000000000000000LL
#define SIZE 10000
int main(){
ll n,m,ans;
set<ll> ss;
scanf("%lld%lld",&n,&m);
while(1){
if(n%m==0){
ans=n/m;
while(ans%10==0) ans/=10;
printf("%lld\n",ans);
return 0;
}
n%=m;
if(ss.find(n)!=ss.end()){
puts("-1");
return 0;
}
ss.insert(n);
n*=10;
}
return 0;
}
goodbaton