結果
| 問題 | No.25 有限小数 |
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2015-07-29 19:37:17 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 865 bytes |
| 記録 | |
| コンパイル時間 | 633 ms |
| コンパイル使用メモリ | 100,752 KB |
| 実行使用メモリ | 108,592 KB |
| 最終ジャッジ日時 | 2026-04-01 13:20:21 |
| 合計ジャッジ時間 | 8,617 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 1 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);
for(int i=0;i<10000000;i++){
if(n%m==0){
ans=n/m;
while(ans%10==0) ans/=10;
printf("%lld\n",ans%10);
return 0;
}
n%=m;
if(ss.find(n)!=ss.end()){
puts("-1");
return 0;
}
ss.insert(n);
n*=10;
}
puts("-1");
return 0;
}
goodbaton