結果
| 問題 |
No.25 有限小数
|
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2015-07-29 19:37:17 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 865 bytes |
| コンパイル時間 | 699 ms |
| コンパイル使用メモリ | 78,200 KB |
| 実行使用メモリ | 205,860 KB |
| 最終ジャッジ日時 | 2024-07-17 22:12:05 |
| 合計ジャッジ時間 | 8,779 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 1 TLE * 1 -- * 11 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:27:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
27 | scanf("%lld%lld",&n,&m);
| ~~~~~^~~~~~~~~~~~~~~~~~
ソースコード
#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