結果
| 問題 |
No.25 有限小数
|
| コンテスト | |
| ユーザー |
ふーらくたる
|
| 提出日時 | 2016-07-30 16:55:53 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 691 bytes |
| コンパイル時間 | 495 ms |
| コンパイル使用メモリ | 60,528 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-06 21:19:21 |
| 合計ジャッジ時間 | 1,454 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 WA * 15 |
ソースコード
#include <iostream>
#include <set>
#include <string>
using namespace std;
typedef unsigned long long ull;
int main() {
ull N, M;
int ans = 0, times = 0;
set<ull> recorder;
cin >> N >> M;
while (N != 0) {
times++;
if (times > 200) {
cout << -1 << endl;
break;
}
/*
if (recorder.find(N) != recorder.end()) {
cout << -1 << endl;
return 0;
}
recorder.insert(N);
*/
string str = to_string(N / M);
for (auto ch : str) {
if (ch != '0') ans = ch - '0';
}
N = (N % M) * 10;
}
cout << ans << endl;
return 0;
}
ふーらくたる