結果

問題 No.1224 I hate Sqrt Inequality
ユーザー root__786root__786
提出日時 2020-09-11 21:54:37
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 707 bytes
コンパイル時間 2,348 ms
コンパイル使用メモリ 206,204 KB
実行使用メモリ 128,228 KB
最終ジャッジ日時 2023-08-27 14:09:41
合計ジャッジ時間 5,816 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,756 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 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
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(k==0 || n==0){ cout<<"No";exit(0);}
    if (res == "") 
        cout << "No"; 
    else
        cout << "Yes"; 
}
0