結果

問題 No.1224 I hate Sqrt Inequality
ユーザー root__786root__786
提出日時 2020-09-11 21:51:33
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 668 bytes
コンパイル時間 2,151 ms
コンパイル使用メモリ 207,064 KB
実行使用メモリ 136,156 KB
最終ジャッジ日時 2023-08-27 13:59:18
合計ジャッジ時間 5,822 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,760 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long int
string fractionToDecimal(int numr, int denr) 
{ 
    string res;
    map <int, int> mp; 
    mp.clear(); 
  
    int rem = numr%denr; 
  
    while ( (rem!=0) && (mp.find(rem) == mp.end()) ) 
    { 
        mp[rem] = res.length(); 
  
        rem = rem*10; 
  
        int res_part = rem / denr; 
        res += to_string(res_part); 
  
        rem = rem % denr; 
    } 
  
    return (rem == 0)? "" : res.substr(mp[rem]); 
} 
signed main() {
    int n,k,t,r,l;
    cin>>n>>k;
    string res = fractionToDecimal(n,k); 
    if (res == "") 
        cout << "No"; 
    else
        cout << "Yes"; 
}
0