結果
| 問題 |
No.25 有限小数
|
| コンテスト | |
| ユーザー |
ふーらくたる
|
| 提出日時 | 2016-07-30 16:56:47 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 694 bytes |
| コンパイル時間 | 667 ms |
| コンパイル使用メモリ | 60,176 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-06 21:19:23 |
| 合計ジャッジ時間 | 1,374 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 WA * 1 |
ソースコード
#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;
return 0;
}
/*
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;
}
ふーらくたる