結果
問題 | No.25 有限小数 |
ユーザー |
![]() |
提出日時 | 2015-07-29 19:35:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 822 bytes |
コンパイル時間 | 580 ms |
コンパイル使用メモリ | 78,080 KB |
実行使用メモリ | 232,476 KB |
最終ジャッジ日時 | 2024-07-17 22:11:35 |
合計ジャッジ時間 | 8,443 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 WA * 2 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); 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; }